Hi @jeremybong,
Firstly I would not recommend setting your callback function to your /login, but to the Root URL directly or a simple /callback
route, since that should be the reason why this is causing a loop in your application. A few details on setting the Callback URL in a React app can be checked using this community post.
The “Login required” error is most likely caused by calling getAccessTokenSilently
at the wrong moment in time. The SDK might still have to parse the code
and state
parameters received from the Idp, so it might not have processed the full authentication flow yet and an unauthenticated session is being returned. I can recommend checking the isLoading
and isAuthenticated
functions from the useAuth0 hook in the React SDK.
Hope this helps!
Thanks,
Remus