Microsoft-graph-docs: These instructions don't make any sense

Created on 6 Aug 2020  Â·  6Comments  Â·  Source: microsoftgraph/microsoft-graph-docs

The request body must contain the following parameter: 'grant_type'

// Line breaks are for legibility only.

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

client_id=535fb089-9ff3-47b6-9bfb-4f1264799865
&scope=https%3A%2F%2Fgraph.microsoft.com%2F.default
&client_secret=qWgdYAmab0YSkuL1qKv5bPX
&grant_type=client_credentials

The endpoint is returning an error.

Do people look at the instructions they post and actually think to themselves if they make sense and if they really would work if someone tried to use them?


Document Details

⚠ Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.

Most helpful comment

Ok, that's odd. The included request in the docs has grant_type=client_credentials. That error tells me either however you're sending it left it out, or you maybe didn't send it as application/x-www-form-urlencoded?

I used Postman, there's an included token request for app-only token in our Graph Postman collection.

image

All 6 comments

Works fine for me. What error are you getting?

@jasonjoh can you give your example postman or curl your using exactly minus your credentials.

this is a part of the error output. it just gives that all of the time.
The request body must contain the following parameter: 'grant_type'

Ok, that's odd. The included request in the docs has grant_type=client_credentials. That error tells me either however you're sending it left it out, or you maybe didn't send it as application/x-www-form-urlencoded?

I used Postman, there's an included token request for app-only token in our Graph Postman collection.

image

@jasonjoh Where did you get the clientID and ClientSecret From. Just double checking that exactly.

I registered an application in the Azure portal. This is mentioned in step 1.

@jasonjoh that was it. Thank you sir. Also, lol, that x-www-form urlencoded is not perhaps the most commonly used param body. Was that in the docs?

Was this page helpful?
0 / 5 - 0 ratings

Related issues

bijithbalan picture bijithbalan  Â·  4Comments

GregSpyra picture GregSpyra  Â·  4Comments

dcnoren picture dcnoren  Â·  4Comments

RobinBreman picture RobinBreman  Â·  4Comments

aaronrogers picture aaronrogers  Â·  3Comments