# Credential cacheing for Authorization Code Flow with PKCE

**URL:** <https://community.auth0.com/t/credential-cacheing-for-authorization-code-flow-with-pkce/82438>\
**Category:** Get Help\
**Created:** [April 26, 2022, 8:00pm UTC](https://community.auth0.com/t/credential-cacheing-for-authorization-code-flow-with-pkce/82438 "2022-04-26T20:00:15Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![Terry.Humphries](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/terry.humphries/32/8700_2.png) [@Terry.Humphries](https://community.auth0.com/u/Terry.Humphries)\
**Post date:** [April 26, 2022, 8:00pm UTC](https://community.auth0.com/t/credential-cacheing-for-authorization-code-flow-with-pkce/82438/1 "2022-04-26T20:00:15Z")

</div>

When I use Authorization Code Flow with PKCE are the credentials cached in the browser session? I’m asking such that if a user close my native app and then 10 minutes later opens it again and I call the logon will it pull the cached credentials or will they have to logon again? I’m assuming the credentials havn’t expired.

---

<div class="post-metadata">

**Author:** ![dan.woda](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/dan.woda/32/18340_2.png) [@dan.woda](https://community.auth0.com/u/dan.woda)\
**Post date:** [April 27, 2022, 5:28pm UTC](https://community.auth0.com/t/credential-cacheing-for-authorization-code-flow-with-pkce/82438/3 "2022-04-27T17:28:06Z")

</div>

Hi @Terry.Humphries,

What do you mean by credential? Tokens aren’t stored in the browser by default, and passwords are never stored or persisted by our SDKs.

Do you have a specific SDK you are working with? They can function differently depending on your settings and environment.

---

<div class="post-metadata">

**Author:** ![Terry.Humphries](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/terry.humphries/32/8700_2.png) [@Terry.Humphries](https://community.auth0.com/u/Terry.Humphries)\
**Post date:** [April 27, 2022, 6:10pm UTC](https://community.auth0.com/t/credential-cacheing-for-authorization-code-flow-with-pkce/82438/4 "2022-04-27T18:10:14Z")

</div>

We have an internal app that use the Logon method of Auth0.OidcClient.Core using the client credential flow. While we do not save the token that is returned. the next time a user runs the app and logon is called it returns a token with actually prompting the user so we think something must be stored in a browse secure cookie that keeps it from prompting for credentials again.

---

<div class="post-metadata">

**Author:** ![dan.woda](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/dan.woda/32/18340_2.png) [@dan.woda](https://community.auth0.com/u/dan.woda)\
**Post date:** [April 27, 2022, 8:04pm UTC](https://community.auth0.com/t/credential-cacheing-for-authorization-code-flow-with-pkce/82438/5 "2022-04-27T20:04:42Z")

</div>

@Terry.Humphries,

The [client credentials flow](https://auth0.com/docs/get-started/authentication-and-authorization-flow/client-credentials-flow) doesn’t involve any users and shouldn’t involve a browser or login.

Maybe it would be helpful if you share your code so we have a clearer picture of what your application is doing.

---

<div class="post-metadata">

**Author:** ![Terry.Humphries](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/terry.humphries/32/8700_2.png) [@Terry.Humphries](https://community.auth0.com/u/Terry.Humphries)\
**Post date:** [April 28, 2022, 1:17pm UTC](https://community.auth0.com/t/credential-cacheing-for-authorization-code-flow-with-pkce/82438/6 "2022-04-28T13:17:41Z")

</div>

Dan, Our flow is as follows, Edit a bit to remove unrelated code:  
We call this function to build the Auth0 client

```auto
        private Auth0Client BuildClient()
        {
            var clientOptions = new Auth0ClientOptions()
            {
                Domain = auth0Configuration.Domain,
                ClientId = auth0Configuration.ClientId,
            };
            clientOptions.PostLogoutRedirectUri = clientOptions.RedirectUri;

            return new Auth0Client(clientOptions,
                                   logger,
                                   BrowserControlType.WebBrowser,
                                   showWindowAction,
                                   () => new Window()
                                   {
                                       Height = 500,
                                       Name = "WebAuthentication",
                                       ResizeMode = ResizeMode.NoResize,
                                       Title = "Authenticating...",
                                       Width = 400,
                                       WindowStartupLocation = WindowStartupLocation.CenterOwner
                                   });
        }

```

Then we call our Login method:

```auto
        private async Task<bool> Login(Auth0Client client)
        {
            LoginResults = string.Empty;
            var url = !string.IsNullOrEmpty(auth0Configuration?.ServiceUrl) ? auth0Configuration?.ServiceUrl : "Authorization.ServiceUrl not set in Settings file.";
            var extraParams = new Dictionary<string, string> { { "audience", auth0Configuration.ServiceUrl } };

            var loginResult = await client.LoginAsync(extraParameters: extraParams);

```

The user gets prompted for login credentials. loginReults contains the access token, etc.

Then the next time the user runs the app if the token hasn’t expired when we call Login it immediately returns with the access token, etc  
The user is not prompted. So something is cached somewhere

---

<div class="post-metadata">

**Author:** ![dan.woda](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/dan.woda/32/18340_2.png) [@dan.woda](https://community.auth0.com/u/dan.woda)\
**Post date:** [May 4, 2022, 4:52pm UTC](https://community.auth0.com/t/credential-cacheing-for-authorization-code-flow-with-pkce/82438/7 "2022-05-04T16:52:32Z")

</div>

It’s likely a cookie is persisting the session in the browser. You can inspect the request and see what is happening by using devtools network tab.

Alternatively, you can send me a [HAR](https://auth0.com/docs/troubleshoot/guides/generate-har-files) file of the flow and I can tell you what is happening.

---

<div class="post-metadata">

**Author:** ![dan.woda](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/dan.woda/32/18340_2.png) [@dan.woda](https://community.auth0.com/u/dan.woda)\
**Post date:** [June 28, 2022, 10:31pm UTC](https://community.auth0.com/t/credential-cacheing-for-authorization-code-flow-with-pkce/82438/8 "2022-06-28T22:31:15Z")

</div>


