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

api.accessToken.addScope is not working #786

Open
6 tasks done
victorcopque opened this issue Jul 11, 2024 · 2 comments
Open
6 tasks done

api.accessToken.addScope is not working #786

victorcopque opened this issue Jul 11, 2024 · 2 comments
Labels
bug Something isn't working

Comments

@victorcopque
Copy link

victorcopque commented Jul 11, 2024

Checklist

Description

In the Actions flow, if you want to modify the accessToken using api.accessToken.addScope, the token remais the same. Action that I used as example:

exports.onExecutePostLogin = async (event, api) => {
    const appMetadata = event.user.app_metadata;
    var permissions = appMetadata?.authorization?.permissions;

    var requestedScopes = event.request.body.scope || event.request.query.scope;
    var parsedScopes = requestedScopes.split(" ");
  
    var allScopes = parsedScopes.concat(permissions);

    allScopes.forEach(scope => api.accessToken.addScope(scope));
};

NOTE: if you run the "same code" in Auth Pipeline > Rules, it works! 🎉

Reproduction

  1. Create a Custom Action
  2. Adds the new action created in the Post Login Flow
  3. Fill the login form with your credentials
  4. Submit Form

So if you inspect the token retrieved after login, the scopes remains unchanged

Additional context

No response

auth0-react version

2.2.4

React version

18.2.0

Which browsers have you tested in?

Chrome

@victorcopque victorcopque added the bug Something isn't working label Jul 11, 2024
@aobster
Copy link

aobster commented Sep 20, 2024

I have the same behavior, no scopes are added even though the login flow completed successfully.

@ankur-kumar-wdc
Copy link

I am also facing same issue. Has anybody found a resolution?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants