0

I've integrated my application with Azure AD authentication. While I can successfully login through the same, I want to access the response claims sent by AD post re-direction of my application from AD to homepage.

So, I've followed Microsoft Docs to get the response claims. i.e., https://app-name.azurewebsites.net/.auth/me

I can see access-token, id-token etc in my response, while I hit the url from my browser.

Now, for my API URLs to get validated, I've to pass access-token in my authorization header. But, also, I want to validate the passed access token (from API) through Azure service, for which the way is:

POST https://<appname>.azurewebsites.net/.auth/login/aad HTTP/1.1
Content-Type: application/json

{"id_token":"<token>","access_token":"<token>"}

I want to test the same first through postman, but, I get 401 unauthorized.

enter image description here

Gaurav Gupta
  • 873
  • 2
  • 8
  • 25
  • I assume you want to validate the tokens your webapi are receiving right? Take a look in the following: https://stackoverflow.com/a/39870281/1384539 – Thiago Custodio Jan 20 '20 at 15:52
  • Try to add bearer token in Postman. Go to Authorization tab, from the _type_ drop down select _Bearer Token_ and provide the token. – Michael Jan 20 '20 at 15:57
  • @ThiagoCustodio I've gone through the link, seems like, it is not exactly the same which I need. I'm expecting the workaround as per the doc: https://learn.microsoft.com/bs-cyrl-ba/azure/app-service/app-service-authentication-how-to – Gaurav Gupta Jan 20 '20 at 16:05
  • @Michael tried that too, the same error! – Gaurav Gupta Jan 20 '20 at 16:07

1 Answers1

3

If you use aad provider, just pass the {"access_token":"<access_token>"} in the body.

See here:

enter image description here

First, login to https://app-name.azurewebsites.net/.auth/me, copy the id_token(not the access_token).

enter image description here

Then in the postman, pass the id_token copied to the {"access_token":"<access_token>"}.

enter image description here

Joy Wang
  • 39,905
  • 3
  • 30
  • 54