React Native Logout without call to webauth

Hey all, I am building in Auth0 logout logic for my React Native app and would like to not have the browser window pop-up whenever a user logs out using auth0.webauth.clearSession as described in the quickstart. I have also tried logging out using a fetch POST call to the url received via auth0.auth.logoutUrl, but I have a few questions about that as well.

When using auth.logoutUrl, I can see that the logout is captured in my Logs. However, both the Connection and the Application fields stay N/A. When I logout with auth0.webauth.clearSession Application is filled in correctly but Connection is N/A. In both cases, there is no user information in the response and the History for the specific user does not show any information about logout attempts. Shouldn’t there be a log here to tie the user to the Auth0 logout? How am I supposed to know if a user has logged out of Auth0 if the logout is not tied to the user?

Here’s a code snippet:

    const credentials = {
      domain: "xxxxx",
      clientId: "xxxxx"
};

export function logout(redirect) {
	const auth0 = new Auth0(credentials);
  	// const logoutUrl = auth0.auth.logoutUrl({});
  	// fetch(logoutUrl)
  	// .then(success => {
  	//     Alert.alert(
  	//         'Logged out!'
  	//     );
	  //     redirect();
  	// })
  	// .catch(console.log('LOGOUT URL FAILED'));

  	auth0.webAuth
  	   .clearSession({})
  	   .then(success => {
  	       Alert.alert(
  	           'Logged out!'
  	       );
  	       //  Application Logout Logic
  	   })
  	   .catch(error => {
  	       console.log('Log out cancelled');
  	   });
}

Thanks.

1 Like

Hey all,

Just checking to see if there’s any input on this.

Much appreciated.

Hi @info31. I’m experiencing the same situation. Just posting here to spike the interest.

still actual question

Hi all
still actual question

Hey there everyone!

Can somebody from you raise it as a GitHub issue in our react-native repo as I think that will be the best way to handle that discussing it directly with the repo maintainers.