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

Added token.getWithPopup, token.getWithRedirect, and token.parseFromUrl #30

Merged
merged 6 commits into from
Jul 21, 2016

Conversation

lboyette-okta
Copy link
Contributor

@lboyette-okta lboyette-okta force-pushed the lb-94708-token-getWithPopup branch from 2ecc743 to 928a55e Compare July 21, 2016 04:40
@lboyette-okta lboyette-okta changed the title Added token.getWithPopup Added token.getWithPopup, token.getWithRedirect, and token.parseFromUrl Jul 21, 2016
@lboyette-okta lboyette-okta force-pushed the lb-94708-token-getWithPopup branch from 3ae8341 to f680133 Compare July 21, 2016 05:55
// 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]);

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"?

Copy link
Contributor Author

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() {
Copy link

@alexma-okta alexma-okta Jul 21, 2016

Choose a reason for hiding this comment

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

what does .fin do?

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

@alexma-okta
Copy link

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) {
Copy link
Contributor

@rchild-okta rchild-okta Jul 21, 2016

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.

@rchild-okta
Copy link
Contributor

lgtm 🚀

@lboyette-okta lboyette-okta merged commit d1b5e54 into master Jul 21, 2016
@jmelberg-okta jmelberg-okta deleted the lb-94708-token-getWithPopup branch April 23, 2018 16:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants