Skip to content

Fix invalid http status code about DPoP initial response from 401 to 400#329

Open
dutkiewicz wants to merge 1 commit intobluesky-social:mainfrom
dutkiewicz:fix-invalid-http-error-response-for-dpop-initial-call
Open

Fix invalid http status code about DPoP initial response from 401 to 400#329
dutkiewicz wants to merge 1 commit intobluesky-social:mainfrom
dutkiewicz:fix-invalid-http-error-response-for-dpop-initial-call

Conversation

@dutkiewicz
Copy link
Copy Markdown

According to docs, when a request without nonce is made, Bluesky will respond with HTTP 401 Unauthorized. But it's not true, in fact it returns HTTP 400 Bad Request. That's even covered in the demo app.

This PR fixes this typo.

@bnewbold
Copy link
Copy Markdown
Contributor

bnewbold commented May 9, 2025

It depends on whether the Auth Server (PDS or entryway, doing a token request) or Resource Server (PDS, for authorized XRPC requests) is doing DPoP.

For the Auth Server, HTTP 400 and a response body is the correct response:

[...] the authorization server responds to requests that do not include a nonce with an HTTP 400 (Bad Request) error response per Section 5.2 of RFC6749 using use_dpop_nonce as the error code value.
https://datatracker.ietf.org/doc/html/rfc9449#section-8

For the resource server, it is HTTP 401 and the WWW-Authenticate header:

Resource servers use an HTTP 401 (Unauthorized) error code with an accompanying WWW-Authenticate: DPoP value and DPoP-Nonce value to accomplish this.
https://datatracker.ietf.org/doc/html/rfc9449#section-9

The guide should be updated to differentiate between the two.

@bnewbold bnewbold self-assigned this May 9, 2025
@bnewbold bnewbold added the bug Something isn't working label May 9, 2025
@bnewbold bnewbold removed their assignment May 9, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants