For testing purposes I am trying to manually get an access token. The guide Request an access token in Azure Active Directory B2C basically describes two steps:
I am having issues on step 2:
According to the instructions one shall make a POST
request and specify https://jwt.ms as redirect_uri
. I am using Postman to make this POST
request, but in this case I have no chance to get the reply that is sent to https://jwt.ms ? So how could that work at all? Am I misunderstanding something? (I am still quite new to OAuth 2)
I tried to reproduce the same in my environment and got the results as below:
I created an Azure AD Application and exposed an API:
Now, I added the API permissions like below:
I generated the auth-code by using below endpoint:
https://b2ctenant.b2clogin.com/b2ctenant.onmicrosoft.com/B2C_1_Signinsignup/oauth2/v2.0/authorize?
&client_id=7969b8c5-e6c6-49ab-b012-xxxxx
&response_type=code
&redirect_uri=https://jwt.ms
&response_mode=query
&scope=https://b2ctenant.onmicrosoft.com/7969b8c5-e6c6-49ab-b012-d59xxxxx/test.read
&state=12345
I generated the access token using below parameters:
https://b2ctenant.b2clogin.com/b2ctenant.onmicrosoft.com/B2C_1_Signinsignup/oauth2/v2.0/token
client_id:7969b8c5-e6c6-49ab-b012-d598a9d99d17
grant_type:authorization_code
scope:https://b2ctenant.onmicrosoft.com/7969b8c5-e6c6-49ab-b012-xxxxxx/test.read
code:code
redirect_uri:https://jwt.ms
client_secret:ClientSecret