-
Notifications
You must be signed in to change notification settings - Fork 271
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
Added token.getWithPopup, token.getWithRedirect, and token.parseFromUrl #30
Conversation
Resolves: OKTA-94708
2ecc743
to
928a55e
Compare
3ae8341
to
f680133
Compare
// Create token array in the order of the responseType array | ||
for (var t = 0, tl = tokenTypes.length; t < tl; t++) { | ||
var tokenType = tokenTypes[t]; | ||
tokens.push(tokenDict[tokenType]); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would that be possible that the tokenDict has no key of tokenType? Need to add a check to prevent pushing "undefined"?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good catch. It's technically possible if they pass a tokenType we don't support in addition to token
or id_token
. I'll add a check.
.then(handleOAuthResponse) | ||
.then(function(res) { | ||
return handleOAuthResponse(sdk, oauthParams, res); | ||
}) | ||
.fin(function() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what does .fin do?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nevermind, it's just an alias of finally
LGTM |
decode: util.bind(token.decodeToken, sdk) | ||
}; | ||
|
||
// This is exposed so we can set window.location in our tests | ||
sdk.token.getWithRedirect._setLocation = function(url) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Another option is to create some util helper functions "util.redirect" and "util.getLocation" - in that case, we wouldn't be able to easily test those methods, but it would be easy to test everything that depends on them, i.e. would be able to mock without having to expose private methods.
Edit: On further thought, maybe not since you want to be able to test it from the sdk level. Will need to think about this some more.
lgtm 🚀 |
Resolves: OKTA-94708
@rchild-okta
@alexma-okta