-
-
Notifications
You must be signed in to change notification settings - Fork 51
Fixed getUserFromClient
not being awaited in client credentials grant.
#218
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
Fixed getUserFromClient
not being awaited in client credentials grant.
#218
Conversation
getUserFromClient
not being awaited in client credentials grant.
Thanks a lot @shrihari-prakash !!! Can you please update the following test in it('should return a token', function() {
const token = {};
const model = {
getUserFromClient: async function(client) {
client.foo.should.equal('bar');
return { id: '123'};
},
saveToken: async function(_token, client, user) {
client.foo.should.equal('bar');
user.id.should.equal('123');
return token;
},
validateScope: function() { return 'foo'; }
};
const grantType = new ClientCredentialsGrantType({ accessTokenLifetime: 120, model: model });
const request = new Request({ body: {}, headers: {}, method: {}, query: {} });
return grantType.handle(request, { foo: 'bar' })
.then(function(data) {
data.should.equal(token);
})
.catch(should.fail);
}); Please use |
@jankapunkt , lint:fix seems to be modifying every js file in the repository. Is this expected? I am not seeing any visible line changes, but possibly it is changing all crlf line endings to lf. |
For now, I just added the test. Let me know if |
@shrihari-prakash no worries, it was just a hint, because sometimes pasting crashes the formatting. Looks good to me. |
Integrations seem to be failing now... |
@shrihari-prakash no worries this is a CI config issues, which is already fixed on the 5.0.0 branch, CI should complete there sucessdully |
Summary
getUserFromClient
was not awaited in client credentials grant, this results in a promise being passed to thevalidateScope
function in the model instead of the actual user.Linked issue(s)
#217 217
Involved parts of the project
Client Credentials grant
Added tests?
NA
OAuth2 standard
Reproduction