Search code examples
postmantokenazure-authenticationazure-ad-b2b

Can't get ID token even with Auth code flow via Postman


I am trying to get ID token and Refresh token along with access token from Azure AD app via Postman by using below parameters:

GET
https://login.microsoftonline.com/mytenant_id/oauth2/v2.0/token
client_id='myclient_id'
&client_secret='myclient_secret'
&grant_type=authorization_code
&scope=https://graph.microsoft.com/.default
&redirect_uri=https://jwt.ms

I am able to get the access token, but not sure why I am not getting ID token and Refresh token along with it.

Atfirst, I tried with client_credentials flow, but I came to know I have to use auth code flow or OpenID Connect in order to get those tokens.

So I shifted to auth code flow. But still I'm getting access token only:(

I have also enabled the below options in the Portal

[enter image description here](https://i.imgur.com/wZjSfhv.png)

What else settings are needed to get the tokens? Any suggestions would be appreciated.

Edited:

I have given below API permissions:

enter image description here


Solution

  • Please note that, getting ID token and Refresh token along with access token depends on the scope/API permissions you grant to the application as mentioned in this MsDoc.

    enter image description here

    I tried to reproduce the same in my environment and added scopes like below:

    enter image description here

    After adding the openid and offline_access in the scope, I got all tokens successfully like below:

    ![enter image description here](https://i.imgur.com/5ojwIDd.png)