Getting OAuth (client_credentials for M2M flow) to make HTTP request to SharePoint REST API

%3CLINGO-SUB%20id%3D%22lingo-sub-2890194%22%20slang%3D%22en-US%22%3EGetting%20OAuth%20(client_credentials%20for%20M2M%20flow)%20to%20make%20HTTP%20request%20to%20SharePoint%20REST%20API%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2890194%22%20slang%3D%22en-US%22%3E%3CP%3EHi%20all%2C%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EI'm%20working%20on%20an%20integration%20that%20will%20be%20making%20CRUD%20HTTP%20requests%20to%20a%20SharePoint%20online%20instance%20(I%20have%20a%20Microsoft%20365%20developer%20subscription).%20Before%20developing%20the%20integration%20I'm%20testing%20with%20Postman%20on%20how%20to%20get%20the%20OAuth%20token%20and%20making%20a%20trial%20request%20to%20be%20sure%20that%20authorization%20is%20working.%3C%2FP%3E%3CP%3ETo%20get%20the%20OAuth%20token%20I've%20followed%20the%20instructions%20(are%20there%20any%20Microsoft%20'official'%20guidelines%20on%20how%20to%20do%20this%3F)%20from%20%3CA%20href%3D%22http%3A%2F%2Fpratapreddypilaka.blogspot.com%2F2018%2F05%2Fsharepoint-online-authentication-for.html%22%20target%3D%22_blank%22%20rel%3D%22nofollow%20noopener%20noreferrer%22%3Ehttp%3A%2F%2Fpratapreddypilaka.blogspot.com%2F2018%2F05%2Fsharepoint-online-authentication-for.html%3C%2FA%3E%20and%20I%20manage%20to%20get%20an%20OAuth%20token.%3C%2FP%3E%3CP%3EWhen%20I%20try%20to%20use%20the%20token%20I%20got%20in%20Postman%20to%20make%20a%20simple%20test%20HTTP%20request%20(%3CA%20href%3D%22https%3A%2F%2Fxxxxxx.sharepoint.com%2Fonesite%2F_api%2Fweb%3F%24select%3DTitle%22%20target%3D%22_blank%22%20rel%3D%22nofollow%20noopener%20noreferrer%22%3Ehttps%3A%2F%2Fxxxxxx.sharepoint.com%2Fonesite%2F_api%2Fweb%3F%24select%3DTitle%3C%2FA%3E)%20I%20get%20a%20401%20error%20with%20the%20following%20message%20%7B%22error%22%3A%22invalid_request%22%2C%22error_description%22%3A%22Token%20type%20is%20not%20allowed.%22%7D%3C%2FP%3E%3CP%3ECan%20someone%20provide%20some%20guidance%20on%20how%20to%20get%20'the%20right'%20token%20to%20interact%20with%20SharePoint%20REST%20API%3F%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EThanks%20in%20advance%3C%2FP%3E%3CP%3EVicente%3C%2FP%3E%3C%2FLINGO-BODY%3E
New Contributor

Hi all,

 

I'm working on an integration that will be making CRUD HTTP requests to a SharePoint online instance (I have a Microsoft 365 developer subscription). Before developing the integration I'm testing with Postman on how to get the OAuth token and making a trial request to be sure that authorization is working.

To get the OAuth token I've followed the instructions (are there any Microsoft 'official' guidelines on how to do this?) from http://pratapreddypilaka.blogspot.com/2018/05/sharepoint-online-authentication-for.html and I manage to get an OAuth token.

When I try to use the token I got in Postman to make a simple test HTTP request (https://xxxxxx.sharepoint.com/onesite/_api/web?$select=Title) I get a 401 error with the following message {"error":"invalid_request","error_description":"Token type is not allowed."}

Can someone provide some guidance on how to get 'the right' token to interact with SharePoint REST API?

 

Thanks in advance

Vicente

0 Replies