Auth0 version: @auth0/auth0-spa-js@2.1.3
React version: react@18.3.1
browser tested in : chrome and edge
loginWithRedirect({
authorizationParams: {
audience: config.audience,
scope: “openid profile email offline_access”,
redirect_uri: “callback”,
access_type: “offline”,
include_granted_scopes: “true”,
connection_scope: “google calendar consent”,
connection: “google-oauth2”,
},
});
await incrementalConsentGoogle(getConsentPopup())
.then(async () => {
setAllowAccess(isChecked);
})
.catch(async (error: Error) => {
});
the error keeps showing every login.
inportantly, this error can been see when run Auth0 sample App by change LoginWithRedirect to LoginWithPopup
When I run the sample-01 in you website, just change loginWithRedirect to loginWithPopup and check the console, the error message is there.
and the error can’t been catched within try…catch
Hi @msgraceguan
Welcome to the Auth0 Community!
Could you let me know if the proposed solution by me in this related community post is able to fix your issue?
Otherwise, can you also try these following steps regarding troubleshooting the issue:
- On the login page, register an event listener for local storage. We will be listening for a change to an
isLoggedIn flag set in the popup window.
- When the user clicks “login” open a popup window on a route that immediately triggers the Auth0 redirect.
- The user is redirected to Auth0 and logs in.
- Auth0 then redirects back to my site, we check for success, and set the
isLoggedIn flag to a truthy value.
- The popup window can now close itself.
- Back in the main window, the local storage event listener is triggered, and we can use the Auth0 method
getAccessTokenSilently to refresh the auth state.
If you still experience issues or have any other questions, let me know!
Kind Regards,
Nik
Hi @msgraceguan
Since I haven’t heard back from you for a while, I will be marking my previous reply as a solution. You can remove the solution before the topic closes automatically if you still experience issues or you can always post again and reference this post.
Kind Regards,
Nik