I can log out as follows: At login time, I store the token in localStorage and in the logout method, I did as follows:

//LOGOUT GOOGLE
    const token = await AsyncStorage.getItem("@ellot:googleAccessToken");
    if (token) {
      try {
        await AuthSession.revokeAsync({ token }, { revocationEndpoint: 'https://oauth2.googleapis.com/revoke' });
        await AsyncStorage.removeItem("@my:googleAccessToken");
      } catch (error) {
        console.log('ERROR XXX', error)
      }
    }
    //LOGOUT GOOGLE
Answer from Edinho Rodrigues on Stack Overflow
🌐
Expo Documentation
docs.expo.dev › versions › latest › sdk › auth-session
AuthSession - Expo Documentation
If the user cancelled the authentication session by closing the browser, the result is { type: 'cancel' }.
🌐
Auth0
community.auth0.com › get help
Logout with Expo - Auth0 Community
December 1, 2020 - Hi there, I’m facing similar problems to the following unresolved issues: I’m able to log in to auth0 using the example here: https://github.com/expo/examples/tree/master/with-auth0 I’m using the following to try to log the user out await WebBrowser.openBrowserAsync( ${myAuth0Domain}/v2/logout?client_id=${auth0ClientId}&returnTo=${redirectUrl}, ) When I do so and check the logs in the auth0 console, I see a successful logout.
🌐
GitHub
gist.github.com › jdthorpe › aaa0d31a598f299a57e5c76535bf0690
expo-auth-session example · GitHub
Thank you for sharing this! Works great with Auth0, within a few modifications (endpoint, clientId, and setting an appropriate path in makeRedirectUri).
🌐
Auth0
community.auth0.com › get help
Logout from Expo app - Auth0 Community
February 12, 2019 - I’m trying to implement Universal Login in my Expo app. I’ve followed this example so far : GitHub - expo/auth0-example: This example has moved I’m able to get an access token. Now I’m trying to logout my user. This is my attempt so far : await WebBrowser.openBrowserAsync( "https://goferworkondemand.eu.auth0.com/v2/logout", ) However, when I call /authorize endpoint again, the user is not logged out.
🌐
GitHub
github.com › expo › examples › issues › 125
Logout Example using Auth0 Expo · Issue #125 · expo/examples
March 22, 2020 - The example with Auth0 does not show users how to logout from the expo app. I am able to login successfully using the Auth0 example but unable to implement logout and there is scant information on this subject on the web
Published   Mar 22, 2020
🌐
GitHub
github.com › expo › auth0-example › issues › 25
Logout · Issue #25 · expo/auth0-example
Reload to refresh your session. ... This repository was archived by the owner on Feb 21, 2020. It is now read-only. ... This repository was archived by the owner on Feb 21, 2020. It is now read-only. ... Thanks for this example. I'm struggling with logout: I've tried this, but without success: await WebBrowser.openBrowserAsync( "https://goferworkondemand.eu.auth0.com/v2/logout", )
🌐
npm
npmjs.com › package › expo-auth-session
expo-auth-session - npm
Expo module for browser-based authentication. Latest version: 7.0.10, last published: 10 days ago. Start using expo-auth-session in your project by running `npm i expo-auth-session`. There are 74 other projects in the npm registry using expo-auth-session.
      » npm install expo-auth-session
    
Published   Dec 05, 2025
Version   7.0.10
Author   650 Industries, Inc.
🌐
Medium
medium.com › @shawnastaff › expo-react-native-tutorials-475acaef8b71
Expo React Native Tutorials. Part 4: Sign Out and Clean Up | by Shawna Staff | Medium
December 27, 2024 - That’s exactly what we’ll be tackling in this part of the tutorial. ... Add a Sign-Out Button: Integrate a logout option into the header bar for easy access. Set Up Navigation Tabs: Use @expo...
Find elsewhere
🌐
Expo
forums.expo.dev › expo sdk
How do I implement logout using AuthSession API? - Expo SDK - Forums
February 5, 2020 - Please provide the following: SDK Version: 40 Platforms(Android/iOS/web/all): iOS Add the appropriate “Tag” based on what Expo library you have a question on. #AuthSession Hello, I’ve implemented federated sign in for Google per the example at Authentication - Expo Documentation but, ...
🌐
Reddit
reddit.com › r/reactnative › how do you fully logout (remove a specific cookie?)
r/reactnative on Reddit: How do you fully logout (remove a specific cookie?)
February 14, 2023 -

I'm using Azure B2C to authenticate, and once the user logs in B2C adds a cookie to the system browser.

The problem I'm having, after the users logs out of the app, and goes to re-login, they're automatically authenticated without being prompted for their credentials.

I'm using expo and can't seem to figure out how to fully "logout."

I've tried revokeAsync with AuthSession, as well as React Native Cookies to attempt to remove the cookie with no success.

How is this usually handled?

Any help appreciated!

🌐
Descope
descope.com › blog › post › expo-authentication
Add Authentication to an Expo App With Descope
The logout function revokes the tokens and resets the authentication state. In this blog, you learned the benefits of pairing Expo with Descope for creating personalized and secure user authentication for your mobile apps.
🌐
Reddit
reddit.com › r/expo › expo-auth-session issue
r/expo on Reddit: expo-auth-session issue
April 15, 2024 -

Hello,

I hope someone can help with this expo issue.

I am trying to use the expo-auth-session to implement SSO with Facebook and getting the following message. Looking at the URL, it seems like it's able to retrieve the access_token from Facebook but something is throwing it off...

I saw a couple of articles on this error and they suggest to use the proxy parameter. But this field was obsolete and removed from the version i am using...

anybody has any idea what's going on??

🌐
Stack Overflow
stackoverflow.com › questions › tagged › expo-auth-session
Newest 'expo-auth-session' Questions - Stack Overflow
I'm building the mobile version for a website, and using the identity server for authentication, I'm using expo-auth-session for handling this but I'm facing a problem redirecting back to my app, is ...
🌐
JAMES IRISH
jamesirish.io › blog › auth0-pkce-flow-using-expo-authsession
Auth0 Authorization Code Flow with PKCE using Expo AuthSession — JAMES IRISH
April 3, 2024 - One challenge with this, Expo’s AuthSession proxy website (see their docs for more) doesn’t correctly handle logout redirects back to the app which is a little disappointing. While you can clear the application state & storage easily, clearing the Auth0 session cookies requires the browser.
🌐
ITNEXT
itnext.io › user-authentication-with-expo-cli-6ac853c272d4
User Authentication with Expo cli | by Evan Burbidge | ITNEXT
January 24, 2023 - How to use Auth0 for User Authentication with Expo cli A guide to using expo cli with Auth0 to manage user Authentication. Introduction During a project it was decided early on that the application …
🌐
Stack Overflow
stackoverflow.com › questions › 76464834 › what-is-the-correct-way-to-logout-from-identityserver4-in-react-native-expo
reactjs - What is the correct way to logout from IdentityServer4 in React Native Expo - Stack Overflow
const authDiscoveryDocument = { authorizationEndpoint: `${domain}/authorize`, tokenEndpoint: `${domain}/oauth/token`, } const authRequestConfig = { redirectUri, clientId, scopes: [...], // This option is the key: Prompt is from expo-auth-session // this will make web login prompt ALWAYS ask username/password when you call promptAsync // even if user is still logged in // Otherwise the browser will ALWAYS use existing credentials to silently login // hence not allowing users to switch account prompt: Prompt.Login, } const [authRequest] = useState(new AuthRequest(authRequestConfig)) const [authResponse, setAuthResponse] = useState(null) const handleLogin = async () => { const loginResponse = await authRequest.promptAsync(authDiscoveryDocument, { // @showInRecents option allows web login screen to stay "in memory" even if user // switches to a diff app in the middle of authentication (e.g.
🌐
GitHub
gist.github.com › lemmensaxel › 72ece5cd00026cc05888701d7d65fbe0
React-native expo + keycloak PKCE flow implemented using expo AuthSession · GitHub
Thanks for the example, it has been very useful, but i'm still scratching my head on redirect URIs, trying to make my authentication worflow work on Android and IOS simulators and also Web, using expo managed workflow and development builds : First, it seems using { useProxy : true } like you do in your code is deprecated now, as stated here : https://auth.expo.io/ Then, when building my redirectUri like that : const redirectUri = AuthSession.makeRedirectUri(); When doing the promptAsync(), I'm getting the keycloak error : Invalid parameter : redirect_uri error · I found out that I don't get any error redirect_uri error when specify a path, like : const redirectUri = AuthSession.makeRedirectUri({ path: "redirect", }); And then everything works fine on IOS and Web (login, logout...).
🌐
Reddit
reddit.com › r/expo › expo-auth-session returns dismiss result on redirect, android only
r/expo on Reddit: Expo-auth-session returns dismiss result on redirect, Android only
May 3, 2023 -

Minimal reproducible example

https://gist.github.com/PotatoPope/8763ee032673c020670fa821ad1a2583

Summary

Our app uses a third-party OAuth Provider, we manage to log into the provider, but after the login we encounter a bug during the redirect.

The Bug

When using promptAsync to get a response when logging in with oauth2 on Android, the function returns dismiss. Normally dismiss happens when a user exits the login flow halfway, however in this case the login is completed successfully. The flow works fine on iOS. On emulator the flow stops up with a chrome error: cache miss or invalid url scheme. On a physical phone to flow manages to get back to the app with the response with type dismiss.

Expo SDK 49

After attempting to upgrade to Expo SDK 49 in order to fix the bug, another bug appeared:

[Error: Call to function 'ExpoWebBrowser.openBrowserAsync' has been rejected. → Caused by: No matching browser activity found]

Possible causes

The response will be dismiss on Android whenever the app is returned to before the redirect handler is called. Because the intent filter in the manifest is misconfigured it will never be hit on standalone apps, and always returns dismiss. Reference: https://github.com/expo/expo/issues/12044

Maybe the dismiss response is simply a correlation, and not a cause. There might be a problem with the redirection or the token which causes an auto-dismiss.

What I’ve tried

Adding promptAsync(discovery, { useProxy, showInRecents:true });

Adding a timeout to promptasync, in case it didn’t get enough time.

Added scheme to app.json, tried different variations of scheme name

Upgraded Expo SDK, and expo-auth-session

Experimented with different android models and os versions, as well as multiple physical phones.

Created a build, using our keystore

Tried multiple browsers.

Changed parameters in the authReqConfig.

Useful threads

https://github.com/expo/expo/issues/6679#issuecomment-570963717

https://github.com/expo/expo/issues/12044

https://stackoverflow.com/questions/66080607/expo-authsession-returns-dismiss-on-android-device

Environment

  expo-env-info 1.0.5 environment info:
    System:
      OS: macOS 13.4
      Shell: 5.9 - /bin/zsh
    Binaries:
      Node: 16.19.1 - ~/.nvm/versions/node/v16.19.1/bin/node
      Yarn: 1.22.19 - /opt/homebrew/bin/yarn
      npm: 8.19.3 - ~/.nvm/versions/node/v16.19.1/bin/npm
      Watchman: 2023.07.10.00 - /opt/homebrew/bin/watchman
    Managers:
      CocoaPods: 1.12.1 - /opt/homebrew/bin/pod
    SDKs:
      iOS SDK:
        Platforms: DriverKit 22.2, iOS 16.2, macOS 13.1, tvOS 16.1, watchOS 9.1
    IDEs:
      Android Studio: 2022.2 AI-222.4459.24.2221.9862592
      Xcode: 14.2/14C18 - /usr/bin/xcodebuild
    npmPackages:
      expo: ~48.0.0 => 48.0.20 
      react: 18.2.0 => 18.2.0 
      react-native: 0.71.8 => 0.71.8 
    npmGlobalPackages:
      eas-cli: 3.17.0
      expo-cli: 6.3.9
    Expo Workflow: managed

Link to github issue: https://github.com/expo/expo/issues/23781

Top answer
1 of 2
1
We solved the issue, we suspect it was something wrong with the base scheme url in expo go. When we built the project, and ran the build, the app redirected as it was supposed to.
2 of 2
1
I have also tried some of the solutions you have mentioned, but none have worked unfortunately. If you are still encountering this problem, as of September 2024, my solution was to get the link manually, and then process the authentication flow. Note: #1. This use effect only gets triggered on Android, not in IOS (For IOS I still use the useAuthRequest hook, it still works just fine.) 2. And you can still get the code verifier via the request from useAuthRequest, though it still returns `type: dismiss`, since it is client-side it you can still use it Here is what I did: ``` //region: Get Link When Redirecting import { Linking } from "react-native"; import React, { useEffect } from "react"; useEffect(() => { const handleURL = (event: { url: string }) => { if (event.url) { const params = event.url.split("?")[1]; const paramsObject = Object.fromEntries(new URLSearchParams(params)); // continue here... // ( What I did on my end was that I saved this to a Redux State \ // and continue the authentiAcation process from there ) } }; const linking_listener = Linking.addEventListener("url", handleURL); return () => { linking_listener.remove(); }; }); //region: Get Link When Redirecting import { Linking } from "react-native"; import React, { useEffect } from "react"; useEffect(() => { const handleURL = (event: { url: string }) => { if (event.url) { const params = event.url.split("?")[1]; const paramsObject = Object.fromEntries(new URLSearchParams(params)); // continue here... // ( What I did on my end was that I saved this to a Redux State \ // and continue the authentiAcation process from there ) } }; const linking_listener = Linking.addEventListener("url", handleURL); return () => { linking_listener.remove(); }; }); ```