Cypress Login command for IdentityServer and oidc-client-js

1.1k views Asked by At

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:<random_guid> 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.

0

There are 0 answers