0
votes

I am able to connect to MS Graph API through the Graph Explorer, and using the SDK in C#. However, when I use the same information as the SDK in Postman, I get a 400 error. I am POSTing to https://login.microsoftonline.com/TENANTID/oauth2/v2.0/token HTTP/1.1 (with our tenant id) and using x-www-form-urlencoded to send:

  • client_id=OURCLIENTID
  • scope=https://graph.microsoft.com/.default
  • client_secret=OURCLIENTSECRET
  • grant_type=client_credentials

The response is always a 404.

I based this in the Get Token Request call from Microsoft(https://docs.microsoft.com/en-us/graph/auth-v2-service#token-request), so I am not sure why it is not working. Any help would be appreciated.

1

1 Answers

0
votes

OK...I was confused by the formatting on the MS site:

POST https://login.microsoftonline.com/{tenant}/oauth2/v2.0/token HTTP/1.1 Host: login.microsoftonline.com Content-Type: application/x-www-form-urlencoded

I was trying to post to https://login.microsoftonline.com/{tenant}/oauth2/v2.0/token HTTP/1.1

when I needed to post to https://login.microsoftonline.com/{tenant}/oauth2/v2.0/token