import auth0 from '../../../../utils/auth0';
export default auth0.handleAuth();
and inside utils/auth0 I have this:
import { initAuth0 } from '@auth0/nextjs-auth0';
import { env } from '../next.config';
export default initAuth0({
baseURL: env.AUTH0_BASE_URL,
});
And when I get redirected to localhost, I get this response: id_token not present in TokenSet
Any ideas?
Update:
After upgrading the package from 1.9.2 to 2.2.1 I’m getting a different error: Callback handler failed. CAUSE: Missing state parameter in Authorization Response.
I was using embedded login for passwordless, as in, I’ve had an input in my web page, and then I would send an axios request with the email to {tenantUrl}/passwordless/start, but the I checked the /api/auth/login route (handled by auth0/next-auth0), and it seems like the package handles this by setting some cookies before sending the request (nonce, state, i think there was one more?). I guess these cookies are verified on the api/auth/callback route when getting redirected from the magic link, which is why I’m getting this error.
Would it be viable to set these cookies myself before firing the request to passwordless/start, while still using the auth0/next-auth0 package? If so, could you point me to some documentation about these cookies?
In case this is not possible, would the auth0-js package help me more here?
This is correct. The state error you mentioned would suggest that the transient state cookie is missing when your browser returns to the /callback URL.