# Logout cache issue in auth0-flutter

**URL:** <https://community.auth0.com/t/logout-cache-issue-in-auth0-flutter/98998>\
**Category:** Get Help\
**Tags:** oidc-enterprise-connection, connections\
**Created:** [January 26, 2023, 2:20am UTC](https://community.auth0.com/t/logout-cache-issue-in-auth0-flutter/98998 "2023-01-26T02:20:39Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![nain93](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/nain93/32/43947_2.png) [@nain93](https://community.auth0.com/u/nain93)\
**Post date:** [January 26, 2023, 2:20am UTC](https://community.auth0.com/t/logout-cache-issue-in-auth0-flutter/98998/1 "2023-01-26T02:20:39Z")

</div>

i’m using auth0-flutter with firebase auth [GitHub - auth0/auth0-flutter: Auth0 SDK for Flutter](https://github.com/auth0/auth0-flutter)

When I log in, log out, and then log in again, I am logged in immediately without logging in because of the web cache.

So, in the safari settings, press clear browsing history and website data, then return to the app and log in, then log in normally.

sign in

```auto
var auth0 = Auth0(Config().auth0Domain, Config().auth0ClientId);
await FirebaseAuth.instance.signInWithProvider(provider);

```

sign out

```auto
await auth0.credentialsManager.clearCredentials(); << i think not working
await FirebaseAuth.instance.signOut();

```

i’m tried already [Authentication API Explorer](https://auth0.com/docs/api/authentication#logout)  
and `auth0.credentialsManager.clearCredentials()`

---

<div class="post-metadata">

**Author:** ![ty.frith](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/ty.frith/32/58484_2.png) [@ty.frith](https://community.auth0.com/u/ty.frith)\
**Post date:** [January 27, 2023, 12:14am UTC](https://community.auth0.com/t/logout-cache-issue-in-auth0-flutter/98998/3 "2023-01-27T00:14:03Z")

</div>

Hi there @nain93 welcome to the community!

> [@nain93](#):
>
> When I log in, log out, and then log in again, I am logged in immediately without logging in because of the web cache.
> 
> So, in the safari settings, press clear browsing history and website data, then return to the app and log in, then log in normally.

Out of curiosity, do you experience this if your device is set to use a different browser? Are you testing on a physical device or emulator?

I unfortunately do not have a physical iOS device to test with, but I am not experiencing the same issue on the Android side using our sample and a physical device - I’d need to investigate further on the iOS side.

It might be worth checking out our sample app to see if you can reproduce the same issue there:

> **[GitHub - auth0-samples/auth0-flutter-samples: Auth0 Integration Samples for...](https://github.com/auth0-samples/auth0-flutter-samples)**
>
> Auth0 Integration Samples for Flutter Applications - GitHub - auth0-samples/auth0-flutter-samples: Auth0 Integration Samples for Flutter Applications

Let us know!

---

<div class="post-metadata">

**Author:** ![nain93](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/nain93/32/43947_2.png) [@nain93](https://community.auth0.com/u/nain93)\
**Post date:** [January 30, 2023, 5:32am UTC](https://community.auth0.com/t/logout-cache-issue-in-auth0-flutter/98998/4 "2023-01-30T05:32:42Z")

</div>

Thank you for reply @tyf  
I’ll upload a case where it doesn’t work as an example project.

After logging out, I want to log in with another auth0, but since it logs in automatically, I need to clear the chrome cache and log in again.

The example was run on an Android emulator.

![example_auth0](https://global.discourse-cdn.com/auth0/original/3X/a/d/ad479e3af775033a56175c0a8e02fbed43fa7b85.gif)

---

<div class="post-metadata">

**Author:** ![ty.frith](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/ty.frith/32/58484_2.png) [@ty.frith](https://community.auth0.com/u/ty.frith)\
**Post date:** [January 31, 2023, 1:38am UTC](https://community.auth0.com/t/logout-cache-issue-in-auth0-flutter/98998/5 "2023-01-31T01:38:57Z")

</div>

Hey there @nain93 thanks for testing!

I’m still unable to reproduce what you are seeing - I’ve tested both on a physical device (Pixel 5a API 33) as well as in the emulator (Pixel 6 API 33) for Android. For iOS I tested using the the simulator (iPhone 14 Pro iOS 16.2).

Are you integrating Firebase into the sample at all or running it as is? I’m unfortunately not familiar with using Firebase Auth.

---

<div class="post-metadata">

**Author:** ![nain93](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/nain93/32/43947_2.png) [@nain93](https://community.auth0.com/u/nain93)\
**Post date:** [January 31, 2023, 2:03pm UTC](https://community.auth0.com/t/logout-cache-issue-in-auth0-flutter/98998/6 "2023-01-31T14:03:17Z")

</div>

@ty.frith  
As you said, I found that there was no cache problem if I didn’t use firebase and used the `auth0.webAuthentication().login()` method.  
but, I get a `not Found` error

I have set AUTH0\_DOMAIN and AUTH0\_CLIENT\_ID in env and set callback url.

My test AUTH0\_DOMAIN is `dev-hafexce35igndtuw.us.auth0.com and callback url is https://dev-hafexce35igndtuw.us.auth0.com/android/com.auth0.sample/callback` I set com\_auth0\_scheme to `https` and login as `auth0.webAuthentication().login()`

![example2](https://global.discourse-cdn.com/auth0/original/3X/b/b/bbbb2a90e66e068f4cd125540e54136cbf049f2f.gif)

---

<div class="post-metadata">

**Author:** ![ty.frith](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/ty.frith/32/58484_2.png) [@ty.frith](https://community.auth0.com/u/ty.frith)\
**Post date:** [January 31, 2023, 11:37pm UTC](https://community.auth0.com/t/logout-cache-issue-in-auth0-flutter/98998/7 "2023-01-31T23:37:05Z")

</div>

> [@nain93](#):
>
> As you said, I found that there was no cache problem if I didn’t use firebase and used the `auth0.webAuthentication().login()` method.

Awesome, thanks for confirming!

Regarding the `not found` error, please see the following post as more often than not it’s related to the https scheme:

> [@Flutter - gives not found instead of redirecting to app](https://community.auth0.com/t/flutter-gives-not-found-instead-of-redirecting-to-app/98929/3):
>
> Hey there @ableflyer welcome to the community! Most users end up using a custom auth0scheme as opposed to https - For example, if I were to set auth0scheme: "demo" and add the callback url demo://mydomain.us.auth0.com/android/com.auth0.androidsample/callback to my application settings in my Auth0 dashboard. Some more on using https (and Android App Links) here: Hope this helps!

---

<div class="post-metadata">

**Author:** ![nain93](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/nain93/32/43947_2.png) [@nain93](https://community.auth0.com/u/nain93)\
**Post date:** [February 1, 2023, 4:15am UTC](https://community.auth0.com/t/logout-cache-issue-in-auth0-flutter/98998/8 "2023-02-01T04:15:09Z")

</div>

thanks @ty.frith  
~~but I already saw the answer  
I think this is not a callback url problem  
Because if I entered the wrong callback url, a mismatch error occurred.  
The current situation is because the callback url mismatch error does not appear.  
And I think there is no problem with my callback url, so please check it.~~

~~And the not found error occurs only on Android.~~

The strange thing is that when com\_auth0\_scheme is set to demo, a not found error does not occur, and when set to https, a not found error occurs.

---

<div class="post-metadata">

**Author:** ![ty.frith](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/ty.frith/32/58484_2.png) [@ty.frith](https://community.auth0.com/u/ty.frith)\
**Post date:** [February 1, 2023, 10:52pm UTC](https://community.auth0.com/t/logout-cache-issue-in-auth0-flutter/98998/9 "2023-02-01T22:52:38Z")

</div>

Hey @nain93 thanks for the update!

I believe this is expected behavior, unless using [Android App Links](https://developer.android.com/training/app-links) - FWIW most SDK users end up just using a custom scheme as opposed to https.

Which Android API is your emulator device on? There’s some discussion around these here:

> **[Issues · auth0/auth0-flutter](https://github.com/auth0/auth0-flutter/issues)**
>
> Auth0 SDK for Flutter. Contribute to auth0/auth0-flutter development by creating an account on GitHub.

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/auth0/original/3X/b/5/b560f266932fcce5d57f09a6595bd50518cae3f3.jpeg) [@system](https://community.auth0.com/u/system)\
**Post date:** [February 15, 2023, 10:53pm UTC](https://community.auth0.com/t/logout-cache-issue-in-auth0-flutter/98998/10 "2023-02-15T22:53:32Z")

</div>

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.
