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

feat: Adds pass-thru of optional 'loginHint' and 'idpScopes' params #238

Merged
merged 3 commits into from
Aug 20, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 16 additions & 12 deletions lib/token.js
Original file line number Diff line number Diff line change
Expand Up @@ -271,23 +271,27 @@ function convertOAuthParamsToQueryParams(oauthParams) {
// Convert our params to their actual OAuth equivalents
var oauthQueryParams = util.removeNils({
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This list was getting long, and to make it easier to compare to the docs I sorted it. Unfortunately this means updating all the unit tests that specified the expected order.

Params are now in alphabetical order except for scope, which is always last.

'client_id': oauthParams.clientId,
'redirect_uri': oauthParams.redirectUri,
'response_type': oauthParams.responseType,
'response_mode': oauthParams.responseMode,
'state': oauthParams.state,
'nonce': oauthParams.nonce,
'prompt': oauthParams.prompt,
'code_challenge': oauthParams.codeChallenge,
'code_challenge_method': oauthParams.codeChallengeMethod,
'display': oauthParams.display,
'sessionToken': oauthParams.sessionToken,
'idp': oauthParams.idp,
'idp_scope': oauthParams.idpScope,
'login_hint': oauthParams.loginHint,
'max_age': oauthParams.maxAge,
'code_challenge': oauthParams.codeChallenge,
'code_challenge_method': oauthParams.codeChallengeMethod
'nonce': oauthParams.nonce,
'prompt': oauthParams.prompt,
'redirect_uri': oauthParams.redirectUri,
'response_mode': oauthParams.responseMode,
'response_type': oauthParams.responseType,
'sessionToken': oauthParams.sessionToken,
'state': oauthParams.state,
});

if (Array.isArray(oauthQueryParams['response_type'])) {
oauthQueryParams['response_type'] = oauthQueryParams['response_type'].join(' ');
}
['idp_scope', 'response_type'].forEach( function( mayBeArray ) {
if (Array.isArray(oauthQueryParams[mayBeArray])) {
oauthQueryParams[mayBeArray] = oauthQueryParams[mayBeArray].join(' ');
}
});

if (oauthParams.responseType.indexOf('id_token') !== -1 &&
oauthParams.scopes.indexOf('openid') === -1) {
Expand Down
Loading