We have an external website that is using Salesforce Identity to authenticate and authorize access to an API.
We have setup the Oauth2 flow using PKCE as per the following link. https://help.salesforce.com/s/articleView?id=sf.remoteaccess_oauth_web_server_flow.htm&type=5
This works fine except the access_token returned is not a JWT. As per the Oauth2 spec and the OpenId spec the Access_token should be a jwt: https://datatracker.ietf.org/doc/html/rfc9068 https://openid.net/specs/oauth-v2-jarm-final.html
Is there a way to get the access token as a JWT as per the specs?
id_token. You might be able to stuff custom claims in there. Access token comes back as JWT only in JWT Bearer flow. – identigral Jan 30 '23 at 19:50id_tokenshould not be used for authorization. In your case if you must use SF for authorization, you don't have much choice. All you can rely on is the user's identity plus associated claims or object graph of assets you can pull out via more API calls back to SF. This is more or less a special case of token exchange minus the official protocol you were interested in your other question. Whether this is ok or not (and leads to security issues) depends on many variables in your solution architecture. – identigral Jan 30 '23 at 20:01