Closed joe-mills closed 3 years ago
Sorry, no idea.
@joe-mills I use vuex-oidc for Vue and have managed to trick my app to think it's logged-in. Maybe this can help you: https://github.com/perarnborg/vuex-oidc/issues/70#issuecomment-679187624
So, to make this question more precise, @brockallen, would the oidc-client-js
library behave exactly as expected if we set the storage as follows?
localStorage.setItem(
`oidc.user:http://localhost:8080/auth/realms/${REALM_NAME}:${CLIENT_NAME},
JSON.stringify(token)
);
If the library would work exactly as expected, then a Cypress test would be capable of operating as if the user had actually logged in.
@dgreene1 yes it should. See my post above
@joe-mills your Cypress issue was solved? I have the same one! can you please help me
Hi,
Question - I'm hoping someone can suggest an approach for making a cypress login command, similar to the one in the article below, work with oidc-client-js
https://auth0.com/blog/end-to-end-testing-with-cypress-and-auth0/
Normally oidc-client-js saves some state to localstorage with the key oidc: before it redirects to IdentityServer with the sate id in the query params.
It then checks the saved state against the logged in details coming back from the IdentityServer when you call UserManager().signinRedirectCallback() on the callback.html page.
Because my cypress test just posts directly to /connect/token, oidc-client-js doesn't set the initial state and then fails the check when it compares the state returned from IdentityServer in callback.html.
I've tried populating the state manually but I can seem to get the guid that oidc-client-js generates or pass one of my own in.
Any hints appreciated