Skip to content

Scope bug #550

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

Open
sm2017 opened this issue Jan 7, 2019 · 0 comments
Open

Scope bug #550

sm2017 opened this issue Jan 7, 2019 · 0 comments

Comments

@sm2017
Copy link

sm2017 commented Jan 7, 2019

In document https://oauth2-server.readthedocs.io/en/latest/model/spec.html#validatescope-user-client-scope-callback

To accept partially valid scopes:

// list of valid scopes
const VALID_SCOPES = ['read', 'write'];

function validateScope(user, client, scope) {
  return scope
    .split(' ')
    .filter(s => VALID_SCOPES.indexOf(s) >= 0)
    .join(' ');
}

Note that the example above will still reject completely invalid scopes, since validateScope returns an empty string if all scopes are filtered out.

If you see https://github.com/oauthjs/node-oauth2-server/blob/master/lib/grant-types/password-grant-type.js#L107-L109 the scope passed to generateAccessToken and generateRefreshToken is requested scope not scope that partially accepted

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants