Repository navigation
Conversation
- Read the client's credentials from an HTTP Basic Authorization header when the body has none, as the client_secret_basic method the discovery document advertises. - Keep body credentials and the invalid_client errors unchanged, with tests and docs.
- Return 400 invalid_request when a request carries an HTTP Basic Authorization header and a client secret, or a different client_id, in its body, as RFC 6749 section 5.2 defines for more than one client authentication method. - Keep a matching client_id in the body accepted and apply the check only when OAuth clients are configured, with tests and docs.
- Return 400 invalid_request with Google's message only when body credentials do not match the HTTP Basic header, and accept an identical duplicate or an empty body secret, as the real token endpoint does. - Keep the 401 invalid_client answers without a WWW-Authenticate challenge, as Google sends none, with tests and docs.
Contributor
|
@jychp is attempting to deploy a commit to the Vercel Labs Team on Vercel. A member of the Team first needs to authorize it. |
| // credentials in an HTTP Basic Authorization header, each form-urlencoded (RFC 6749, section 2.3.1). | ||
| let basic: { id: string; secret: string } | undefined; | ||
| const authHeader = c.req.header("Authorization") ?? ""; | ||
| if (authHeader.startsWith("Basic ")) { |
Contributor
Author
|
Superseded by #406. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Authorizationheader atPOST /oauth2/token, as theclient_secret_basicmethod the discovery document advertises, for authorization code and refresh token grants.400 invalid_requestwhen OAuth clients are configured and the body's credentials do not match the header, while accepting an identical duplicate, a matchingclient_idalone, or an empty body secret, as the real endpoint does.invalid_clienterrors unchanged, without aWWW-Authenticateheader since Google sends none, with regression coverage and docs.References:
client_secret_post,client_secret_basic): https://accounts.google.com/.well-known/openid-configurationinvalid_requestfor more than one client authentication mechanism, and theWWW-Authenticaterequirement Google does not follow: https://www.rfc-editor.org/rfc/rfc6749#section-5.2WWW-Authenticateheader: observed against https://oauth2.googleapis.com/token on 2026-11-13, with the public Google Cloud SDK client ID and dummy secrets and codesFixes #402