I am new to SharePoint world.

I have created an app on SharePoint online. I have been trying to use Postman to get access token using Sharepoint online API but I am getting this error

AADSTS70000: Provided grant is invalid or malformed. error_codes:70000

My Postman request looks below: POST https://accounts.accesscontrol.windows.net/**realm_Id**/tokens/OAuth/2

Header: Content-Type: application/x-www-form-urlencoded

Raw Body:

&client_id=xxxxxxxxxxxxxxxxxxxxxxxxxxxx (UTF8 encoded - **client_id@realm_id**)
&client_secret=xxxxxxxxxxxxxxxx (UTF8 encoded)
&code=xxxxxxxxxxxxxxxx (UTF8 encoded)
&redirect_uri=https%3A%2F%2Fwww.domain.com%2F (UTF8 encoded)
&resource=xxxxxxxxxxxxx%2Fdomain.sharepoint.com%xxxxxxxxxxxxxxx (UTF8 encoded - resource/domain@relamId)

When I send above request, I get error mentioned above.

I checked some other posts about this error & it was pointing towards making sure redirect_uri is same in configured app & API request above. I checked, it is same.

App has redirect_uri as: https://www.domain.co.nz/ (slash at the end).

Can you please help me understand what am I doing wrong here?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.