-
Notifications
You must be signed in to change notification settings - Fork 232
Scopes are not returned when both id_token & token are used to make an okta request #104
Comments
Hey @cohenpts: The const accessToken = this.oktaAuth.getAccessToken();
console.log(`Scopes: ${accessToken.scopes}`); |
I haven't tried to reproduce, but that help link makes it sound like you get a thin access token when requesting access and ID token, and that you have to use use userinfo endpoint to get the full access token. |
that's corrent @robertjd the token does not have the scope information when trying to parse it with https://jwt.io/. when sending only the id_token as the response type I get all the scope information. @jmelberg-okta just tried it, a call to getAccessToken yields undefined. Edit: |
@cohenpts I'm having a hard time reproducing this. Can you provide us with your
|
|
Re: actually the whole tokenManager object is undefined
|
no errors are logged and the token is in localstorage. |
Gotcha @cohenpts. This might be similar to the issue reported here. Just to make sure I'm clear - the
Or - are you saying the In theory, As a reference, I'm using the Okta Angular Samples repository to try and reproduce this issue. |
the token is stored in localstorage under the id
the token object stored have the properties When decrypting the token with the https://jwt.io/ tool i receive the scopes only when the thank you both for the fast reply for this issue. |
@cohenpts - You're correct. I was just drawing a simple map. I may have misunderstood your original question, so I apologize. Scopes are not bound directly to the The easiest way to return the attributes associated with with these You can do that with this library via: const accessToken = this.oktaAuth.getAccessToken();
// Use the underlying AuthJS library to submit the userinfo
// request using the current accessToken.
const userinfo = this.oktaAuth.getOktaAuth().token.getUserInfo(accessToken) : undefined; Hope this unblocks you! |
This works, I am able to get the scope information. Unfortunately the implementation we have requires the token to contain the scope information since we parse the token throughout our app to resolve the scope information embedded. Is there no way to get a token containing the scope information embedded within with OktaAngular? |
The best way to accomplish this is to refresh the this.oktaAuth.getOktaAuth().token.refresh(this.oktaAuth.getIdToken())
.then((token) => console.log("New Token: ", token.idToken)); |
@cohenpts Can you confirm this resolves your use case? If so, lets close this open issue. 😄 |
@jmelberg-okta yes it does, thank for the help! |
using Angular 5.
I am not able to receive the requested scopes.
according to this answer
https://support.okta.com/help/answers?id=9062A000000bmOuQAI&feedtype=SINGLE_QUESTION_DETAIL&dc=Okta_Application_Network&criteria=OPENQUESTIONS&
Scopes can only be received when either id_token or token is used
tested and received scopes after removing token from request.
EDIT
Referencing line:
okta-oidc-js/packages/okta-angular/src/okta/okta.service.ts
Line 103 in ec81340
The text was updated successfully, but these errors were encountered: