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

Refresh token does not use stored scope #726

Open
6 tasks done
monochkov opened this issue Apr 24, 2024 · 0 comments
Open
6 tasks done

Refresh token does not use stored scope #726

monochkov opened this issue Apr 24, 2024 · 0 comments
Labels
bug This points to a verified bug in the code

Comments

@monochkov
Copy link

Checklist

Description

Library version: 2.10.2.

When I use credentialManager.awaitCredentials() I expect that when access token is expired then it is refreshed by refresh token with the scope I used when saved credentials to credentialsManager.
credentialManager.awaitCredentials(scope: String?, minTtl: Int) function says:
Params: scope - the scope to request for the access token. If null is passed, the previous scope will be kept.

But, it actually does not use previous scope.
CredentialsManager line 239 does not use previously saved scope for refreshing token.
If I do not send scope into function as parameter, the scope will be just ignored.

What I expect to have:
Replace this one:

if (scope != null) {
    request.addParameter("scope", scope)
}

with this one:

val scopeForRenew = scope ?: storedScope
if (scopeForRenew != null) {
   request.addParameter("scope", scopeForRenew)
}

Reproduction

  1. Sign in to the app
  2. Wait for access token expiration
  3. Open app again
  4. Refresh token using credentialManager.awaitCredentials() with scope == null

Expected: access token is refreshed using previously stored scope.
Actual: scope is ignored for refreshing token.

Additional context

No response

Auth0.Android version

2.10.2

Android version(s)

Any

@monochkov monochkov added the bug This points to a verified bug in the code label Apr 24, 2024
monochkov added a commit to monochkov/Auth0.Android that referenced this issue Apr 24, 2024
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

1 participant