-
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
Fix error on tokens renew with refresh token #632
Fix error on tokens renew with refresh token #632
Conversation
The state should on the response should match what was sent on the request. Is it possible the state is not being sent? |
It looks like |
test/spec/oidc/renewTokens.ts
Outdated
|
||
return Promise.resolve({ | ||
'id_token': tokens.standardIdToken, | ||
'refresh_token': 'fakeRerfeshTalken' |
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.
Nice :)
test/support/tokens.js
Outdated
'offline_access' | ||
], | ||
'tokenUrl': 'https://auth-js-test.okta.com//oauth2/v1/token', | ||
'authorizeUrl': 'https://auth-js-test.okta.com//oauth2/v1/authorize', |
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.
Are we testing the double //
above deliberately?
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.
thanks - fixed
Codecov Report
@@ Coverage Diff @@
## master #632 +/- ##
==========================================
+ Coverage 92.29% 92.74% +0.45%
==========================================
Files 67 67
Lines 2439 2440 +1
Branches 515 515
==========================================
+ Hits 2251 2263 +12
+ Misses 188 177 -11
Continue to review full report at Codecov.
|
9a074c4
to
96be132
Compare
lib/oidc/renewTokensWithRefresh.ts
Outdated
const { scopes } = getDefaultTokenParams(sdk); | ||
const handleResponseParams = { | ||
scopes |
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.
SDK's scopes
configuration is used for building parsed token objects, however scopes
is also available in /token
response - would it make sense to use it instead?
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 does probably make sense to use the value from the response rather than config. scopes
can be overridden on the call used to obtain the tokens, so it could differ from the configured value.
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.
Done
According to the API docs, |
263d525
to
8475a3e
Compare
lib/oidc/handleOAuthResponse.ts
Outdated
if (res.scope) { | ||
scopes = res.scope.split(' '); | ||
} else { | ||
var scopes = clone(tokenParams.scopes); |
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.
no var
here
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.
Fix the extra var
, then LGTM
/token
response validation fails as code mistakenly expects it to containstate
property .Resolves OKTA-367047