Version Affected: All
Overview
Which client authentication methods does the SecureAuth Identity Platform (IdP) OpenID Connect (OIDC) token endpoint accept? Application vendors often ask this before they change how their application authenticates, for example when they move to client_secret_post.
Answer
The token endpoint accepts two methods, client_secret_basic and client_secret_post, and no others. The token endpoint for a realm is https://<idp-host>/<realm>/OidcToken.aspx. Both methods send the client ID and client secret of the realm's OIDC client:
- client_secret_basic: the client ID and secret go in the Authorization header of the token request, as the word Basic followed by the Base64 encoding of client_id:client_secret.
- client_secret_post: the client ID and secret go in the form body of the token request, as the client_id and client_secret parameters.
An application can use either method without any change to the realm. If a request carries both, the IdP uses the Authorization header. The realm's discovery document, https://<idp-host>/<realm>/.well-known/openid-configuration, lists the same two methods under token_endpoint_auth_methods_supported. JSON Web Token (JWT) client authentication, client_secret_jwt or private_key_jwt, is not supported.
Clients that use Proof Key for Code Exchange (PKCE). When Use with PKCE Protocol is checked for a client (on the realm's Post Authentication tab, under OpenID Connect/OAuth 2.0 - Clients), the token endpoint does not check the client secret when the application exchanges an authorization code for tokens, or when it later uses a refresh token from that exchange. For the code exchange it checks the code_verifier instead, so the request must include the code_verifier that matches the code challenge sent with the authorization request. Without it, the request fails with Missing code verifier, even if the correct secret is sent. If the application can't send the code_verifier, for example because a server now makes the token request instead of the user's device, give it a client that has PKCE turned off and uses the secret.
Client Credentials requests need a custom scope. A token request with grant_type=client_credentials must include a scope parameter that names at least one scope defined on the realm. Create a custom scope for it on the realm's Post Authentication tab, under OpenID Connect/OAuth 2.0 - Scopes; any name works. The standard OIDC scopes (openid, profile, email, address, phone and offline_access) are refused for this grant type. The client must also have Client Credentials checked under its Allowed Flows. When a Client Credentials request breaks one of these rules, the token endpoint returns one of these error_description values:
- Scopes not provided: the request has no scope.
- Unknown scopes: a requested scope is not defined on the realm.
- Invalid scopes: the request includes a standard OIDC scope.
- Invalid scopes for client: a requested scope is not allowed for the client.
- Unauthorized flow: Client Credentials is not checked for the client.
Each client has one secret. An OIDC client holds only one client secret at a time, so changing the secret on a client in use stops sign-in for the application until it has the new secret. To rotate the secret without an outage, add a second client to the same realm with the same redirect Uniform Resource Identifiers (URIs) and Allowed Flows, and give the application the new client's ID and secret. The old client keeps working until it is removed, so the application can switch back if something goes wrong. Remove the old client once sign-in through the new one works.
SecureAuth Knowledge Base Articles provide information based on specific use cases and may not apply to all appliances or configurations. Be advised that these instructions could cause harm to the environment if not followed correctly or if they do not apply to the current use case.
Customers are responsible for their own due diligence prior to utilizing this information and agree that SecureAuth is not liable for any issues caused by misconfiguration directly or indirectly related to SecureAuth products.
Comments
0 comments
Please sign in to leave a comment.