Auth0 Home Blog Docs

Logout from Expo app

logout
expo
#1

I’m trying to implement Universal Login in my Expo app. I’ve followed this example so far : https://github.com/expo/auth0-example

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. What have I done wrong? Has someone successfully managed to logout a user from an Expo app? Did I call the logout endpoint correctly? Should I call it differently? Thanks for your help!

#2

Hey there @aymericbouzy!

Unfortunately I’m not experienced with Expo, however maybe you’ll find out docs on logout helpful:

Let me know if that helps! Otherwise I’ll try to ask internally!

#3

Thanks! I discovered the “https://goferworkondemand.eu.auth0.com/v2/logout” endpoint by reading this documentation. My understanding is that calling this endpoint clears some cookie. I’m wondering if cookies are not stored in separate locations and that could explain why it’s not loging me out successfully?

If you can ask internally, I’d be very grateful. Thanks!

#4

Sure will let you know once I found out something!

#5

So I think I have found the solution : by using WebBrowser.openBrowserAsync https://docs.expo.io/versions/v28.0.0/sdk/webbrowser/#expowebbrowseropenbrowserasyncurl instead of WebBrowser.openAuthSessionAsync for the /authorize endpoint, when calling the logout url, it logs out the user. Regular browser method instead of dedicated authentication method.

Do you know if there is any potential security risk there with this solution?

1 Like
#6

Glad you were able to find it! Let me ask our developer support team and see what they got!