17
Views
1
Comments
Solved
Microsoft graph API Unauthenticate error
Question

Hi All,

i have a requirement where i need to store file in the sharepoint for this,

I have 2 Api's one [POST Api ] for creating a upload session and [PUT Api] for storing the file 

when running in the second api i am getting  un authenticate error,

with the code

 HTTP/1.1 401 FORBIDDEN and {"error":{"code":"unauthenticated","message":"Unauthenticated"}}

and i am passing the authorization token to the api in an variable the post is accepting the api and second one throws this error,

Kindly guide me.

Thanks, and Regards

P Anish

2022-04-19 13-20-22
Andrea Lembo
Solution

Hi,

The rest endpoint "createUploadSession" return a response with an url to use for the upload process.

The upload url returned already have an authtoken in query string : "?authtoken=eyJhbGciOiJSUzI1NiIsImtpZCI6IktmYUNIUlN6bllHMmNI"

So you don't have to send the original jwt.

Br,

AL

Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.