# Refresh Token not getting returned in auth0-nodeJS SDK

**URL:** <https://community.auth0.com/t/refresh-token-not-getting-returned-in-auth0-nodejs-sdk/86205>\
**Category:** Get Help\
**Tags:** refresh-tokens\
**Created:** [June 29, 2022, 11:54pm UTC](https://community.auth0.com/t/refresh-token-not-getting-returned-in-auth0-nodejs-sdk/86205 "2022-06-29T23:54:15Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![matt.kaufman](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/matt.kaufman/32/38482_2.png) [@matt.kaufman](https://community.auth0.com/u/matt.kaufman)\
**Post date:** [June 29, 2022, 11:54pm UTC](https://community.auth0.com/t/refresh-token-not-getting-returned-in-auth0-nodejs-sdk/86205/1 "2022-06-29T23:54:15Z")

</div>

Please include the following information in your post:

- Which SDK this is regarding: Node-auth0
- SDK Version: latest
- Platform Version: node 16?
- Code Snippets/Error Messages/Supporting Details/Screenshots: we’re using the passwordGrant method, and passing in “offline\_access” in scope, but no refresh token is getting returned. Help Please! It works correctly when we do a password grant via HTTPS so I’m certain it isn’t our auth0 settings.

**Is this a feature request or bug report?** Unsure

---

<div class="post-metadata">

**Author:** ![lihua.zhang](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/lihua.zhang/32/39683_2.png) [@lihua.zhang](https://community.auth0.com/u/lihua.zhang)\
**Post date:** [June 30, 2022, 8:46pm UTC](https://community.auth0.com/t/refresh-token-not-getting-returned-in-auth0-nodejs-sdk/86205/3 "2022-06-30T20:46:04Z")

</div>

Hi @matt.kaufman ,

Thank you for posting this topic on the Auth0 Community!

Could you please provide some details such as your scripts, what kind of application your project is, and screenshots for your testing or errors? Please feel free to remove/Pixelate the details that pertain to your tenant. Thanks!

---

<div class="post-metadata">

**Author:** ![matt.kaufman](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/matt.kaufman/32/38482_2.png) [@matt.kaufman](https://community.auth0.com/u/matt.kaufman)\
**Post date:** [June 30, 2022, 9:05pm UTC](https://community.auth0.com/t/refresh-token-not-getting-returned-in-auth0-nodejs-sdk/86205/4 "2022-06-30T21:05:26Z")

</div>

Sure!

Its a Regular Web Application

Here’s our function call, feels very standard:

```auto
const data: Auth0.PasswordGrantOptions = {
      username: email,
      password,
      scope: "openid offline_access",
      realm: AUTH0_CONNECTION,
    };
    const options: Auth0.PasswordGrantAdditionalOptions = {
      forwardedFor: ipAddress,
    };
    const tokens = await authorizationClient.passwordGrant(data, options);

```

We receive the following payload:

```auto
access_token: [token]
expires_in: 86400
id_token: [token]
scope: "openid profile email address phone"
token_type: "Bearer"

```

Note that this is missing the refresh\_token

No errors are thrown

---

<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:** [June 30, 2022, 10:49pm UTC](https://community.auth0.com/t/refresh-token-not-getting-returned-in-auth0-nodejs-sdk/86205/5 "2022-06-30T22:49:24Z")

</div>

Hi again @matt.kaufman! Good to know it’s working as expected using HTTPS, it’s almost like `offline_access` is just being ignored here 🤔

What happens if you omit the `openid` scope and only include `offline_access`? I believe `openid` should be added regardless with the password grant. What about if you create a “dummy” API in Auth0 for testing purposes, enable it for offline access, and pass in an audience of the identifier?

Thinking out loud here @lihua.zhang 🙂

---

<div class="post-metadata">

**Author:** ![lihua.zhang](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/lihua.zhang/32/39683_2.png) [@lihua.zhang](https://community.auth0.com/u/lihua.zhang)\
**Post date:** [July 1, 2022, 12:42am UTC](https://community.auth0.com/t/refresh-token-not-getting-returned-in-auth0-nodejs-sdk/86205/6 "2022-07-01T00:42:39Z")

</div>

Hi @matt.kaufman ,

Thank you for providing the additional context!

Could you please check if “Allow Offline Access” is switched on for the API? [This](https://auth0.com/docs/get-started/apis/api-settings#access-settings) doc has the details.

Also, according to [this](https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/auth0/index.d.ts) github scripts, the PasswordGrantOptions includes the audience parameter. Could you please add it and confirm how it goes? Thanks!

```auto
export interface PasswordGrantOptions {
    username: string;
    password: string;
    realm?: string | undefined;
    scope?: string | undefined;
    audience?: string | undefined;
}

```

---

<div class="post-metadata">

**Author:** ![matt.kaufman](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/matt.kaufman/32/38482_2.png) [@matt.kaufman](https://community.auth0.com/u/matt.kaufman)\
**Post date:** [July 1, 2022, 8:52pm UTC](https://community.auth0.com/t/refresh-token-not-getting-returned-in-auth0-nodejs-sdk/86205/7 "2022-07-01T20:52:35Z")

</div>

Hi! Turns out we were doing something wrong with our build environment, all is working! Thanks for your help 🙂

---

<div class="post-metadata">

**Author:** ![lihua.zhang](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/lihua.zhang/32/39683_2.png) [@lihua.zhang](https://community.auth0.com/u/lihua.zhang)\
**Post date:** [July 1, 2022, 8:54pm UTC](https://community.auth0.com/t/refresh-token-not-getting-returned-in-auth0-nodejs-sdk/86205/8 "2022-07-01T20:54:52Z")

</div>

Hi @matt.kaufman, Thank you for the updates! Glad to know you have resolved this! 👏 👍

---

<div class="post-metadata">

**Author:** ![lihua.zhang](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/lihua.zhang/32/39683_2.png) [@lihua.zhang](https://community.auth0.com/u/lihua.zhang)\
**Post date:** [July 1, 2022, 8:55pm UTC](https://community.auth0.com/t/refresh-token-not-getting-returned-in-auth0-nodejs-sdk/86205/9 "2022-07-01T20:55:05Z")

</div>


