-
Notifications
You must be signed in to change notification settings - Fork 268
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: parseFromUrl return tokens in hash, also include state #311
Conversation
efd2259
to
28a83f5
Compare
8559af4
to
474441f
Compare
@@ -1616,8 +1628,15 @@ The ID token will be [verified and validated](https://github.com/okta/okta-auth- | |||
|
|||
```javascript | |||
authClient.token.parseFromUrl() | |||
.then(function(tokenOrTokens) { | |||
.then(function(res) { |
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.
res
implies an HTTP Response object, is there a better name?
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.
It is an object which contains a tokens
hash and a state
string.
@@ -266,32 +272,28 @@ function handleOAuthResponse(sdk, oauthParams, res, urls) { | |||
|
|||
return verifyToken(sdk, idToken, validationParams) | |||
.then(function() { | |||
tokenDict['id_token'] = idToken; | |||
tokenDict['idToken'] = idToken; |
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.
nit: why not dot notation?
value: res['access_token'], | ||
accessToken: res['access_token'], | ||
expiresAt: Number(res['expires_in']) + Math.floor(Date.now()/1000), | ||
tokenType: res['token_type'], |
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.
nit: why not dot notation for all of these? (underscore isn't a problem, just '-')
474441f
to
9288398
Compare
Changes behavior on
parseFromUrl
Previously:
responseTypes
responseTypes
was not an array, the token object was returnedNow:
state
which contains the value passed togetWithRedirect
(or any of the othergetToken
calls) This allows passing information to the callback handler.tokens
which contains a hash of tokens returned. Possible key values areidToken
andaccessToken
value
which contains the raw token string. For an ID token this is the same as theidToken
field, for an access token it is the same as theaccessToken
field.