Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refreshToken every time null #1446

Open
6 tasks done
mohammad-aljamil opened this issue Jun 30, 2024 · 1 comment
Open
6 tasks done

refreshToken every time null #1446

mohammad-aljamil opened this issue Jun 30, 2024 · 1 comment
Labels
bug This points to a verified bug in the code

Comments

@mohammad-aljamil
Copy link

Checklist

  • The issue can be reproduced in the auth0-js sample app (or N/A).
  • I have looked into the Readme and Examples, and have not found a suitable solution or answer.
  • I have looked into the API documentation and have not found a suitable solution or answer.
  • I have searched the issues and have not found a suitable solution or answer.
  • I have searched the Auth0 Community forums and have not found a suitable solution or answer.
  • I agree to the terms within the Auth0 Code of Conduct.

Description

the refreshToken every time return null

i Enabled offline_access from app settings

this.auth0 = new auth0.WebAuth({
      domain:'AUTH0_DOMAIN',
      audience:'AUTH0_API_AUDIENCE',
      clientID:'AUTH0_CLIENT_ID'),
      redirectUri: window.location.origin + '/callback',
      responseType: 'token id_token',
      scope: ['openid', 'profile', 'email', 'user_metadata', 'offline_access'].join(' '),
    });
    
      silentAuth = () => {
    return new Promise((resolve, reject) => {
      this.auth0.checkSession({}, (err, authResult) => {
        if (err) return reject(err);
        if (!err) {
    
          resolve(authResult);
        }
      });
    });
  };

this json

{
    "accessToken": "xxxx",
    "idToken": "xxxxx",
    "idTokenPayload": {... details }
    "appState": "xxx",
    "refreshToken": null, 
    "state": "xxx",
    "expiresIn": 7200,
    "tokenType": "Bearer",
    "scope": "openid profile email offline_access"
}

when used react auth0 i can get refreshToken

Reproduction

1-silentAuth

Additional context

No response

auth0-js version

9.26.1

Which browsers have you tested in?

Edge, Other

@mohammad-aljamil mohammad-aljamil added the bug This points to a verified bug in the code label Jun 30, 2024
@meck93
Copy link

meck93 commented Aug 22, 2024

According to the official openid documentation: https://openid.net/specs/openid-connect-core-1_0.html#Authentication -> what you're trying to achieve is not possible:

  • response_type: 'token id_token' -> implicit flow

but the implicit flow does not support refresh tokens.

What you have to do is change your flow to either:

  • response_type: 'code id_token token' -> hybrid flow with id_token
  • response_type: 'code token' -> hybrid flow without id_token

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug This points to a verified bug in the code
Projects
None yet
Development

No branches or pull requests

2 participants