{"id":6324,"date":"2019-11-22T21:19:03","date_gmt":"2019-11-22T21:19:03","guid":{"rendered":"https:\/\/blogs.aaddevsup.xyz\/?p=6324"},"modified":"2019-11-22T21:19:05","modified_gmt":"2019-11-22T21:19:05","slug":"setup-postman-to-call-microsoft-graph-using-a-client-credentials-grant-access-token-from-the-v2-endpoint","status":"publish","type":"post","link":"https:\/\/blogs.aaddevsup.xyz\/2019\/11\/setup-postman-to-call-microsoft-graph-using-a-client-credentials-grant-access-token-from-the-v2-endpoint\/","title":{"rendered":"Setup Postman to call Microsoft Graph using a Client Credentials Grant Access Token from the v2 endpoint"},"content":{"rendered":"
To use the V1 endpoint, please refer to this post<\/a>. Our documentation for the client credentials grant type can be found here<\/a>.<\/span><\/span><\/p>\n You can setup postman to make a client_credentials grant flow to obtain an access token and make a graph call ( or any other call that supports application permissions ). This is very useful for testing code you plan to run as a script or in a Daemon application where you do not want user interaction.<\/p>\n The first thing you need is an app registration in your Azure Tenant to perform this flow. Create a new application registration:<\/p>\n Note the application id as you will need it later \u2013 this is the client_id used in the setup for postman:<\/p>\n Click on the API permissions and assign application permissions. By default, Microsoft Graph is already selected with a delegated permission of User.Read. I will leave that there to demonstrate that permission will not be present in the access token when performing this flow. Lets add an application permission for Microsoft Graph of Group.Read.All :<\/p>\n Once added, you will now see your permission listed however, all application permissions always require a tenant admin to consent to these permissions:<\/p>\n Grant admin consent:<\/p>\n Next, the client_credentials flow requires a client secret. Go to the Certificates and Secrets blade and create a new client secret:<\/p>\n The value is only shown one time so be sure to copy it to the clipboard with the copy to clipboard button and store that somewhere safe. You don’t want that secret to get out!<\/p>\n The first method I will demonstrate to you for obtaining an access token with Postman is through the Authorization UI. Start a new request, then click on the Authorization tab and select OAuth 2.0 from the drop-down type list:<\/p>\n