Updating auth0-react login state during cypress test

I’m trying to login to auth0 during a cypress test using auth0-react. I’ve followed this guide -

That guide does not use auth0-react and has a custom state/auth handler which updates once the { access_token, expires_in, id_token } are received.

Is there any simple way to update the auth0-react login state once the tokens are received?

Ideally, I’d be able to use some endpoint to receive the usual code which is given when logging in with the UI. For example, receive code xxx and redirect to:

http://localhost:3000/dashboard?code=xxx&state=yyy

auth0-react would then update the login state automatically when it parses the URL.

Someone asks the same question in a comment on the post but there isn’t a response:

“I would like to be able to implement a Cypress “login” command that exercises my callback with a code (i.e. authorization code) that would typically be acquired via OAuth exchange. Is there an Auth0 API endpoint that allows me to get a code that I can then use for my callback e.g. https://mydomain.com/callback?code=abcd1234?

Any ideas?

A post was merged into an existing topic: End-to-End Testing with Cypress and Auth0