# Using PKCE with auth0-cordova and ionic 5 for refresh tokens

**URL:** <https://community.auth0.com/t/using-pkce-with-auth0-cordova-and-ionic-5-for-refresh-tokens/53726>\
**Category:** Get Help\
**Tags:** pkce, refresh-tokens, login, auth0\
**Created:** [November 23, 2020, 7:26pm UTC](https://community.auth0.com/t/using-pkce-with-auth0-cordova-and-ionic-5-for-refresh-tokens/53726 "2020-11-23T19:26:20Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![mohammadz](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/mohammadz/32/13482_2.png) [@mohammadz](https://community.auth0.com/u/mohammadz)\
**Post date:** [November 23, 2020, 7:26pm UTC](https://community.auth0.com/t/using-pkce-with-auth0-cordova-and-ionic-5-for-refresh-tokens/53726/1 "2020-11-23T19:26:20Z")

</div>

Hi, I’m trying to get refresh tokens in my ionic 5 app. So far I have setup my app setup by following the ionic 4 quickstart. This works fine for the login and authentication part. This is a native app created last month in auth0 and should have refresh\_token grant enabled. The goal here is to provide a seamless user experience.

The main problem here is that even when the `offline_access` scope and the correct `audience` is included, no refresh token is returned.

```
login() {
       this.loading = true;
        const options = {
          scope: 'openid profile offline_access',
          audience: audienceUrl,
        };
        console.log('scope', options);
        console.log('audience', audienceUrl);
        // Authorize login request with Auth0: open login page and get auth results
        this.Client.authorize(options, (err, authResult) => {
          if (err) {
            this.zone.run(() => this.loading = false);
            throw err;
          }
         /* authResult 
              {   
                 accessToken:"",
                 expiresIn:"",
                 idToken: "",
                 scope: "openid profile",
                 tokenType: "Bearer" 
              }
         */
       // storage of tokens and other stuff;
     });
}

```

After digging through auth0-cordova repo, I came across the [following](https://github.com/auth0/auth0-cordova/issues/120#issuecomment-592655457). I also went through the code to double check this as well.

Given that the repo uses auth0-js within it and uses the implicit-flow, how would I setup auth0-cordova to use the PKCE flow instead? Is this is even possible?

Thanks
