Hello @Jon Farmer | Stiperstone,
I got the same error, when passed the same request body:
grant_type=client_credentials
client_id: ClientID
client_secret: Secret
scope: https://graph.microsoft.com/.default
The error is because you are passing the request body is incorrect:
- You are using a JSON-like structure (with colons and line breaks), which is not valid for the
application/x-www-form-urlencoded
content type. - The
application/x-www-form-urlencoded
format expects the parameters to be encoded as a string in key-value pairs, separated by&
, and the keys and values should be URL-encoded if needed.
To resolve the error, pass the request body like below:
grant_type=client_credentials
&client_id=ClientID
&client_secret=Secret
&scope=https://graph.microsoft.com/.default
And the Headers as Content-Type : application/x-www-form-urlencoded
When I run the workflow, access token generated successfully:
Hope this helps!
If this answers your query, do click Accept Answer
and Yes
for was this answer helpful, which may help members with similar questions.
If you have any other questions or are still experiencing issues, feel free to ask in the "comments" section, and I'd be happy to help.