Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fixes microsoft server _sometimes_ failing due to un-required token #1416

Merged
merged 1 commit into from
Dec 18, 2024

Conversation

jzacsh
Copy link
Collaborator

@jzacsh jzacsh commented Dec 18, 2024

we're sometimes seeing the following microsoft server response at the uploadChunk() callsite:

MicrosoftApiResponse{httpStatus=401, httpMessage=, body=Optional[
{
    "error": {
        "code": "unauthenticated",
        "message": "Unauthenticated"
    }
}
]}

which according to their documentation is because we simply aren't supposed to send the token during our chunked byte-upload sequence (PUT), but only during our createSession (POST) call at the start:

If you include the Authorization header when issuing the PUT call,
it may result in an HTTP 401 Unauthorized response. Only send the
Authorization header and bearer token when issuing the POST during
the first step. Don't include it when you issue the PUT call.

-- https://learn.microsoft.com/en-us/graph/api/driveitem-createuploadsession?view=graph-rest-1.0#remarks

@jzacsh jzacsh requested a review from seehamrun December 18, 2024 18:13
we're sometimes seeing the following microsoft server response at the
`uploadChunk()` callsite:

```
MicrosoftApiResponse{httpStatus=401, httpMessage=, body=Optional[
{
    "error": {
        "code": "unauthenticated",
        "message": "Unauthenticated"
    }
}
]}
```

which according to their documentation is because we simply aren't
supposed to send the token during our chunked byte-upload sequence
(PUT), but only during our createSession (POST) call at the start:

> If you include the Authorization header when issuing the `PUT` call,
> it may result in an `HTTP 401 Unauthorized` response. Only send the
> Authorization header and bearer token when issuing the `POST` during
> the first step. Don't include it when you issue the `PUT` call.


-- https://learn.microsoft.com/en-us/graph/api/driveitem-createuploadsession?view=graph-rest-1.0#remarks
@jzacsh jzacsh force-pushed the fix-msoft-token-now-allowed branch from 1825c99 to 208098e Compare December 18, 2024 18:13
@jzacsh jzacsh merged commit 9e967cb into dtinit:master Dec 18, 2024
5 checks passed
@jzacsh jzacsh deleted the fix-msoft-token-now-allowed branch December 18, 2024 18:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants