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
}
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.