Cypress - Authentication and Sessions
What is wrong with this Cypress test code that tries to use a token for authorization?
let token;
cy.request('POST', '/auth', { user: 'admin', pass: 'admin' })
.then(res => {
token = res.body.token;
});
cy.request({
method: 'GET',
url: '/dashboard',
headers: { Authorization: `Bearer ${token}` }
});