Get id token from the access token

60 views Asked by At

I use angular with spring boot

Actually angular app send me the bearer token (access token) to the spring boot (backend end).

With this token is it possible to get the id token?

1

There are 1 answers

0
Naveen Sharma On

To get ID token along with access token, you need to pass openid as the scope.

Grant openid permission to the Microsoft Entra application:

enter image description here

To get ID token along with access token, modify your code by passing scope as openid

scope:  'api://<<<client_id>>>/app openid',  

For sample, I tried to generate tokens via Postman:

https://login.microsoftonline.com/TenantID/oauth2/v2.0/token

client_id:ClientID
scope:api://xxx/api.access openid
grant_type:authorization_code
code:code
redirect_uri:https://jwt.ms
client_secretClientSecret

enter image description here

Reference:

Securing Angular and Spring Boot applications with Azure AD - Jeroen Meys — Ordina JWorks Tech Blog (ordina-jworks.io) by Jeroen Meys