Hi @ankit.makadiya,
An invalid state error occurs when the state value saved to the device’s cookie doesn’t match the state returned by Auth0.
- In your case, you’re calling
login()
several times in succession, and each time, a new state value is being generated and saved to the device, overwriting the previous. - You don’t need to generate your own state values for these; the SDK does this for you.
- You don’t need multiple instances of the Auth0 SDK class; you can do this with the same one.
You should only call login()
immediately before redirecting the user through the authentication process. Storing the generated URLs in this manner won’t work.