Skip to content

Commit

Permalink
Encode multiple scopes using space instead of comma
Browse files Browse the repository at this point in the history
  • Loading branch information
hugopeixoto committed Jun 18, 2018
1 parent 3c8690e commit 28df029
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion lib/client/auth-code.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ module.exports = (config) => {
};

if (Array.isArray(params.scope)) {
params.scope = params.scope.join(',');
params.scope = params.scope.join(' ');
}

const options = Object.assign({}, baseParams, params);
Expand Down
2 changes: 1 addition & 1 deletion test/auth-code.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ describe('authorization code grant type', () => {
it('returns the authorization URI with scopes joined by commas', () => {
const oauth2 = oauth2Module.create(baseConfig);
const authorizationURL = oauth2.authorizationCode.authorizeURL(authConfigMultScopesAry);
const expectedAuthorizationURL = `https://authorization-server.org/oauth/authorize?response_type=code&client_id=the%20client%20id&redirect_uri=${encodeURIComponent('http://localhost:3000/callback')}&scope=user%2Caccount&state=02afe928b`;
const expectedAuthorizationURL = `https://authorization-server.org/oauth/authorize?response_type=code&client_id=the%20client%20id&redirect_uri=${encodeURIComponent('http://localhost:3000/callback')}&scope=user%20account&state=02afe928b`;

expect(authorizationURL).to.be.equal(expectedAuthorizationURL);
});
Expand Down

0 comments on commit 28df029

Please sign in to comment.