We faced the same issue, which turned out to be caused by including an authorization header in the upload task.
If you include the Authorization header when issuing the
PUT
call, it may result in anHTTP 401 Unauthorized
response. Only send the Authorization header and bearer token when issuing thePOST
during the first step. Don't include it when you issue thePUT
call.
So, the solution can be to create a separate GraphServiceClient
with an AuthenticationProvider
that does nothing and to pass its RequestAdapter
when creating a LargeFileUploadTask
.