I am a beginner in using Azure AD with OAuth2. I deployed a sample WEB API in my Azure AD. I consume my WEB API through the Postman application. Before consume the WEB API in Postman I need to generate the access token. But when i generate the access token in post man it's always accept the Grant Type - Authentication Code
. When i change the value to Client Credentials
the generated access token is not accepted in the API. it's shows UnAuthorized
message.
In Azure portal - app settings 'Certificates & Secrets' window i create a client secret with description 'postman'. I didn't upload the certificate in this app.
I want to generate the access token with 'Grant Type' value 'Client Credentials'. Is there any additional configuration for this ?
Is there any additional configuration for this ?
You all need following parameter:
client_id
client_secret
resource
(For v2.0
scope
)grant_type
How Would You Request Token In PostMan :
Your Token Endpoint:
https://login.microsoftonline.com/YourTenent.onmicrosoft.com/oauth2/token
Method Type:
POST
Request Body:
grant_type:client_credentials
client_id:00ab01_Your_Azure-Ad_Application_Id_fbbf8e
client_secret:XNk2zgXx_Your_Azure-Ad_Application_Secret_vjdz2Q
resource:https://graph.microsoft.com/
See the screenshot:
Code Snippet:
Class Used:
Hope that would help. If you still have any concern feel free to share.