Handle Logout error in React SDK

Hi,

I’m trying to handle an error scenario during logout . I’m not able to do so using try catch block. Any documentation on the possible errors and response that might occur during logout and how to do it?

 try {
  logout({ returnTo: window.location.origin });
} catch (e) {
// Show an alert
}

SDK : auth0-react
SDK Version: 1.0.0
Platform Version: Node 14.16.1

Hi @sachindraragul,

There aren’t any documented errors for the logout function. This function doesn’t call an API or anything that could be caught in a try/catch, but simply redirects the user to your tenant’s /logout URL. An error might occur if your application or tenant does not have an allowed logout URL configured, but this is not something that could be caught in the application code. The logout URL is configured in your Auth0 dashboard.

Hope that helps!

Stephanie

1 Like

Thank you for the confirmation.

1 Like

This topic was automatically closed 15 days after the last reply. New replies are no longer allowed.