Hi! The access token received via "regular" login ...
# ask-a-descoper
n
Hi! The access token received via "regular" login (with React embedded on our frontend) we get an "iss" claim which is the project ID. The access token received via oidc (with https://api.descope.com/oauth2/v1/token endoint) we get a different format for the "iss" claim - https://api.descope.com/<project-id>. Is that correct? or a misconfiguration on my side? Is there a way to align both of these? Thanks
m
Yes, because there 2 types of jwt template, once for M2M and one for users See more about it here https://docs.descope.com/management/jwt-templates
Diff jwt templates , have diff claim values, you can use that feature to change iss
n
Configuring a JWT Template will affect both of these? or just the user one
m
You will see there 2 diff templates , one for each So you can change only one of them if you like
n
Those two you mean?
m
Yes
n
I'm looking into it thanks
Are you sure the "iss" claim can be customized? the "Create" button is grayed out when trying to change it (works for other custom claims though)
m
Diff out of the box templates have the diff default values for it, so if you choose another M2M templates ( see the out of the box ones ) They will have either project id or url format for iss
n
ahhh I see. You mean it's not customizable directly by itself but I can use one of the JWT Templates with have it that way already out of the box (and customize other claims)
I think that it works!
Thanks @Meir Wahnon
m
👍
n
actually it didn't work 😞 sorry by bad. I created a new template for each type based on the default ones. both have in the preview the same iss format (jist the project.id)
And applied them here
but it doesn't seem to affect the m2m access token
m
You changed the access key jwt one ?
n
no
Just added it
m
you need to switch here to the one you created
I did it here
m
@Michael Rimboim can you follow up here ?
@Nir Haas plz remember you need to exchange to get new tokens to see new claims
n
of course
m
@Chris Carper @Kevin Gao can you follow up here ?
k
Actually @Nir Haas are you using M2M tokens at all? I read your message to be that you're seeing a difference between tokens created from logging in with a federated app using auth code flow (and the
/token
endpoint) vs normally with a flow and the flow runner or something. Is that correct?
If that's the case, Access Key JWT templates don't apply here.
The reason you're seeing two different types of tokens is because one is an OIDC compliant token (mandated by using the OIDC endpoints) and one is a normal Descope token.
If you want this to be consistent, you'll need to use the AWS API Gateway JWT template for your User JWT template here:
image.png
You'll see the issuer is now in the format of a URL
And all JWTs created with your Descope project will be consistent at that point
n
So the OIDC tokens (m2m) are not customizable through JWT Template, and if I want I can change the "normal" ones to match to the OIDC ones
k
Both OIDC and non OIDC tokens are configurable with JWT templates. I was simply explaining why they are different between regular login and OIDC based login. M2M tokens created with
client_credentials
flow are customizable as well in the Access Key JWT template as @Meir Wahnon said. But normal M2M tokens (just access keys) and normal user tokens that are not created with OIDC endpoints have to use an AWS API Gateway JWT template to keep them OIDC compliant
n
Well, I'm using two flows and non of them is M2M. In both of them it is an actual user, but the one is through "normal" flow and the second is through OIDC. How do I configure the JWT Template to apply to the non-oidc one? I have tried setting the User JWT template but it did not made a change (at least not the iss claim)
m
@Guy Pilosof @Reuven Zabirov can you follow up here with a call to help @Nir Haas?
k
In order to do that, you just have to create an AWS JWT template and apply it to your user JWT template settings. Can you share what your project’s JWT template looks like right now?
m
@Nir Haas would you like a short session to go over this ?
n
I will try later to alight the "normal" tokens to the oidc ones with the API Gateway JWT Template and see if that works. Thanks guys. I will send a msg later to update you
@Meir Wahnon @Kevin Gao Applying the API Gateway jwt template worked. Thanks guys
✅ 1
m
👍