Skip to content Skip to sidebar Skip to footer

Can I Get The Token Through Url Fragement Such As Clientid Etc. In Azure Directly?

Say I have clientId, tenantId, tokenType, redirectUri etc in azure. Can I use those parameters to get access token directly? I know there is a way which is to combine them together

Solution 1:

You can try using response_mode=form_post, access_token , id_token will be sent as post parameter to redirect url. Since tokens are part of post parameters it is not part of url but request body. You can use developer tool to see http trace of the request.

Solution 2:

Get the answer by myself. https://docs.microsoft.com/en-us/azure/active-directory/develop/v2-oauth2-implicit-grant-flow

Click postman in the url, replace some parameters. The token will be displayed in the redirecturi address bar. But it is not good since it is implict flow.

flow

Solution 3:

Implicit flow is usually used in single-page applications. If you are not using a single-page application, using this flow will not make sense.

The auth code flow can only obtain the authorization code in the browser, and then use the authorization code to redeem the token in postman. The auth code flow does not support obtaining tokens directly in the browser address bar, so in your question, you should use the interactive login auth code flow.

1.Request an authorization code in the browser.

https://login.microsoftonline.com/{tenant id}/oauth2/v2.0/authorize?
client_id={client app client id}
&response_type=code
&redirect_uri={redirect_uri}
&response_mode=query
&scope=https://graph.microsoft.com/.default
&state=12345

2.Redeem token in postman.

enter image description here

Post a Comment for "Can I Get The Token Through Url Fragement Such As Clientid Etc. In Azure Directly?"