Ok hello.
My flow is like this:
- The user goes to domain.com (my app)
- I’m generating a log in link and I’m redirecting the user to that log in link. All works fine to this point.
- The user logs in and now he’s redirected back to domain.com with the callback in the url. So at this point i’m calling my checkUrlForAuthRedirectQuery() function
- That function throws “invalid state” from the SDK.
I cannot reproduce this bug, I know that this bug may happen when the callback may have an invalid / expired link but that’s not the case. These users are entering my site for the first time and getting that
This is my check callback url function:
const checkUrlForAuthRedirectQuery = async () => {
try {
const auth0 = await getAuth0Client();
await auth0.handleRedirectCallback();
const tokenClaims = await auth0.getIdTokenClaims();
// Call login API to add cookie
await makeEndpointRequest(
'Login',
{},
{
headers: {
Authorization: `Bearer ${tokenClaims.__raw}`,
},
},
);
router.push('/home');
} catch (err) {
await logError(`CHECK_AUTH0_REDIRECT_QUERY_URL`, err);
}
};