I am using @auth0/auth0-spa-js in my Vue 2 application, with Cypress. I have authentication working using createAuth0Client. However, I want to use programmatic authentication in Cypress to prevent running a UI-traversing login command every time we run a test, which would make our specs take minutes longer equaling to many, many minutes for a single command for all our suites.
I’ve got a request to Auth0 using a username and password successfully returning an access token, but I don’t know how and I can’t figure out from all Auth0’s documentation, specifically Auth Spa JS, to pass that access_token to my auth0 plugin within Vue to authenticate my test user.
I really don’t want to refactor parts of my application to think it’s authenticated if a token exists while the environment is testing.
Yes, I’ve been over this a few times, but the example repo it uses is using auth-js, which I believe is what’s under the hood of auth-spa-js. I am really trying to avoid refactoring my auth0 integration on the FE as it took a LOT of work and refactoring of other pieces of our app to get it working.
I used this post to do most of the Cypress command refactoring and my code closely matches what’s recommended in this post.
I do know my application fails at this portion of the login tests in the post:
const callbackUrl = ...
I don’t have anything looking for those url parameters in my auth0Client plugin as it only recommends looking for state and code.
I can also see that even in the auth-spa-js package, it doesn’t really matter what you pass as parameters in a callback URL because handleRedirectCallback only looks for state, code, error, error_description.
My question → is there a way to pass an auth token to the auth-spa-js package to tell it to use the token to authenticate the user or do I need to swap to a different auth0 JS package?