Beta

Create a tenant

A new tenant starts with its own users, OAuth settings, audit history and logs. You are its first Tenant Admin.

Client authentication methods

A client ID names a client; it proves nothing. A confidential client also has to show, on every direct request to the authorization server, that it holds the credential registered for that ID. How it shows that is its client authentication method, and the method is part of its registration.

Proving which client is asking

When the printer exchanged its authorization code, the token endpoint needed to know that the request really came from the printer. A stolen code alone should not be enough, and neither should knowledge of the client ID, which anyone can read in an authorization URL. The printer proved itself with an Authorization header holding its client ID and secret. That header was one choice among several, and OAuth calls the general idea client authentication.

Client authentication happens where a confidential client talks directly to the authorization server: the token endpoint in every flow we have followed, and other back-channel endpoints, such as those that Token introspection and Token revocation cover. It does not happen in the browser. An authorization request carries only the client ID, because anything placed in a browser URL can be seen by the person using it and by anything that records it.

The goal is always the same: show that the request comes from the party holding the credential registered for this client ID. The methods differ in what that credential is and how much of it travels with each request.

Methods side by side

Registrations name the method with a standard value. These are the ones you will meet most often:

MethodWhat the client sends
client_secret_basicIts client ID and shared secret in an HTTP Basic Authorization header, joined with a colon and Base64-encoded.
client_secret_postIts client ID and shared secret as fields in the request body.
client_secret_jwtA short-lived JWT signed with the shared secret, which must be long and random enough to serve as an HMAC key. The secret itself is not sent.
private_key_jwtA short-lived JWT signed with the client's private key. The server holds only the public key.
tls_client_auth and self_signed_tls_client_authA client certificate, presented while the TLS connection is set up, the way a server presents its own certificate to a browser.
noneOnly its client ID. This is how a public client is registered.

The first two send the secret itself. RFC 6749, the OAuth 2.0 specification, requires an authorization server that issues client secrets to support HTTP Basic, which is why the earlier examples used it. One detail catches many developers: before the client ID and secret are joined with a colon and Base64-encoded, each must be percent-encoded the way a form field is, so a secret containing characters such as + or : is escaped first. A colon left as it is would split the pair in the wrong place. A client that skips this step works with simple secrets and then fails mysteriously with one that contains punctuation.

Sending the secret in the body instead looks like this:

POST /token HTTP/1.1
Host: auth.photos.example
Content-Type: application/x-www-form-urlencoded

grant_type=authorization_code
&code=demo-code-7
&redirect_uri=https%3A%2F%2Fprinter.example%2Foauth%2Fcallback
&code_verifier=btl_training_verifier_for_one_attempt_only_2026
&client_id=photo-printer
&client_secret=demo-only-not-a-real-secret

All domains, identifiers, and credentials in these examples are fictional.

The protection is the same as with Basic. HTTPS hides the secret in transit, and the server compares it with what it holds. RFC 6749 recommends the header form and allows body fields only for clients that cannot use it. The OAuth 2.1 draft reverses that preference because so many implementations got the encoding step wrong: it requires servers to accept the body form and makes Basic optional. Whichever form a client uses, check how its logs treat the secret: many tools that record requests already know to hide an Authorization header, while a secret in an ordinary form field looks like any other field.

The JWT methods take a different approach. The client never sends a reusable secret. It sends a signed JWT stating that it is the client, valid for a few minutes, and the server checks the signature, as Digital signatures described. With private_key_jwt, the server does not hold anything that could be used to create such a statement. The certificate methods move the proof into the TLS connection itself and can also bind the tokens issued to that certificate. Secrets and signed assertions examines the JWT methods in detail, and Authenticating a client with a certificate, in Advanced OAuth, covers mutual TLS.

One method per registration

The printer's registration says client_secret_basic. A careful authorization server holds it to that. A request from photo-printer that puts the secret in the body instead, or offers a JWT, is rejected even if the credential inside it is correct.

That can seem pedantic, but it closes real gaps. If a client registered for private_key_jwt could also present a shared secret, then whatever secret the server still held for that client would become a second way in, and the stronger method would protect nothing. A request must also use only one method at a time: RFC 6749 says a client must not use more than one in the same request. One that carries both a Basic header and a body secret is malformed, not doubly authenticated, so the server refuses it as invalid_request, although some servers report it as invalid_client instead.

Public clients are the other side of this rule. A client registered with none cannot authenticate, so the server relies on other protections, such as PKCE and exact redirect URI matching. It should not treat a public client that sends a made-up secret as if it were confidential.

photo-printer

Client type
confidential
Client authentication
client_secret_basic

The correct secret in every request

Checked against the registered method

  • Basic Authorization header
  • client_secret in the request body
  • Both a Basic header and a body secret
  • Only its client ID

Only the first is accepted

The wrong method is rejected even if the credential inside it is correct.

The printer holds the correct secret in every request, but only the registered method is accepted.

When authentication fails

A wrong secret, an unknown client ID, or the wrong method produces an invalid_client error. When the client tried HTTP Basic, the server answers with status 401 and a WWW-Authenticate header, the standard HTTP way of saying which kind of authentication the endpoint expects:

HTTP/1.1 401 Unauthorized
WWW-Authenticate: Basic realm="auth.photos.example"
Content-Type: application/json
Cache-Control: no-store

{
  "error": "invalid_client"
}

The response does not say which part was wrong. Telling a caller "that client exists, but the secret is wrong" would help someone guessing at secrets. For the same reason, servers limit how many failed attempts they accept for a client.

For the printer, invalid_client is rarely something a retry will fix. It usually means the deployed credential does not match the registration: a secret was replaced but not updated in one place, or a new key was not yet registered.

Check your understanding

Try these questions before moving on. If an answer isn't right, use the feedback and try again.

The printer is registered for private_key_jwt, but a request arrives with a correct client secret in a Basic header. What should the server do? 1 of 3

Choose one answer.

Why does an authorization request in the browser carry only the client ID, even for a confidential client? 2 of 3

Choose one answer.

After a secret change, the printer's new secret contains a +, and its Basic header now fails with invalid_client. What is the likely cause? 3 of 3

Choose one answer.

Try it in the Lab

We value your privacy

We use cookies and similar technologies to enhance your browsing experience, and analytics to understand our traffic. By clicking "Allow all", you consent to optional analytics. Cookie Policy

Learn identity