Auth0 Home Blog Docs

How to logout in React Native

logout
auth0
session
login
react-native

#1

I’ ve followed the react native quickstart, and implemented the “Custom Login Form”

After login for the first time with a my google account using auth0.authorize with connection:"google-oauth2"
whenever i try to login the same way i get automatically logged with my google
account, without letting me choose another.

For what i’ve found the “session” gets saved in the smartphone internet browser.
If i delete the browser data under https://accounts.google.com and try to login with a google account as before,
this time it asks for mail and password.

I want to know if it is possible to make the auth0.authorize ask me to wheter use the last account logged(the one that is saved in the browser) or to log into a different one and also how to “close the session” stored in the browser.


#2

Being able to choose between more than one account or choose to login with another account even when you’re already logged in with a given account is provider-specific. For example, Google supports that notion of multiple sessions and also the possibility to start a new session with a different account even when you already have an active session, but a different social/authentication provider may not provide that ability which would mean that even when using Auth0 to broker the authentication to social providers you’re still bound by what they support if the request you perform requires communicating with the provider.

In your particular case given the downstream identity provider is Google and it supports those mechanisms you can make an /authorize request containing the parameter prompt=select_account. Your Auth0 tenant will forward this parameter to Google which will honor it and allow the user to select an account instead of automatically completing the request when an session already exists.

With regards to logging out of an upstream identity provider, we also support forwarding logout requests to certain upstream providers (see the reference documentation), however, you need to consider the implication of doing such a thing because the user may not want you to do that. For example, the user could want to always be authenticated to Google in the browser and your application forcing a logout from the Google session could be unexpected.


#3

Could you be more specific in how to send the prompt=select_account?
A short example would be great given that there are no examples in the documentation.


#4

Could you be more specific in how to send the prompt=select_account?
A short example would be great given that there are no examples in the documentation.


#5

In the call to authorize method you should pass the additional parameter.


#6