I want to test API endpoint using cypress and want do mocking for AUTH token because it's coming from another API
cy.intercept({
method:'get',
url:'/first endpoint'
},response).as('mocktoken');
cy.request({
method:'get',
url:'/firstendpoint'}).then(response=>{
cy.request({
method:'get',
url:'/secondendpoint'}).then(response=>{ // assertion statement});
Thhis is not working what can be done to implement this scenario
First, i want auth token from first which I am, trying to mock then using this token I will get the response from second endpoint