Blog post: The OIDC relying party, built twice

Confidential client

A server-side application can protect a client secret and keep tokens in a server session. It can authenticate at the token endpoint, receive refresh tokens, validate ID tokens through a mature framework, and perform RP-initiated logout with an id_token_hint.

Public client

Browser and native clients cannot protect a secret. Use authorization code with PKCE and register clientAuthenticationMethod: none.

The client must:

  • Generate and verify state.
  • Generate and verify nonce.
  • Create a high-entropy PKCE verifier and S256 challenge.
  • Validate ID-token issuer, audience, signature, nonce, and expiry.
  • Use explicit CORS origins without credentialed wildcard requests.
  • Minimize token lifetime and browser storage exposure.

Policy differences

ConcernConfidentialPublic
SecretServer-sideNone
PKCERecommendedRequired
Refresh tokenUsually allowedPrefer refused or tightly constrained
Token storageServer sessionHostile browser environment
LogoutLocal + provider sessionExplicit browser flow

Client type is a threat model, not a cosmetic registration field. The provider must enforce different grant, PKCE, and refresh-token policies for each type.