PKCE Authorization Flow
Overview
Section titled “Overview”AuthAction supports the OAuth 2.0 Authorization Code Flow with PKCE (Proof Key for Code Exchange) exclusively. This provides secure, standards-compliant authentication for public clients such as Single Page Applications (SPAs), mobile apps, and desktop applications.
Why PKCE?
Section titled “Why PKCE?”PKCE mitigates authorization code interception attacks and removes the requirement for client secrets, making it suitable for public clients that cannot store credentials securely.
Benefits
Section titled “Benefits”- No client secrets: Public clients do not need to store or transmit secrets
- Code injection protection: Cryptographic binding prevents code substitution
- OAuth 2.1 aligned: Matches current industry best practices
Supported Code Challenge Method
Section titled “Supported Code Challenge Method”AuthAction supports only S256 as the code challenge method. The plain method is not supported for security reasons.
| Parameter | Value |
|---|---|
code_challenge_method | S256 |
How PKCE Works in AuthAction
Section titled “How PKCE Works in AuthAction”-
Authorization Request
- The client generates a
code_verifier(random string). - A
code_challengeis created by hashingcode_verifierusing SHA-256 and encoding it in base64url. - The client sends an authorization request including
code_challengeandcode_challenge_method=S256.
GET /oauth2/authorize?response_type=code&client_id=YOUR_CLIENT_ID&redirect_uri=YOUR_REDIRECT_URI&code_challenge=BASE64URL_SHA256(CODE_VERIFIER)&code_challenge_method=S256 - The client generates a
-
Token Exchange
- The client exchanges the authorization code for tokens, sending the
code_verifierin the request.
POST /oauth2/tokenContent-Type: application/x-www-form-urlencodedgrant_type=authorization_code&client_id=YOUR_CLIENT_ID&code=AUTHORIZATION_CODE&redirect_uri=YOUR_REDIRECT_URI&code_verifier=ORIGINAL_CODE_VERIFIER - The client exchanges the authorization code for tokens, sending the
-
Server Validation
- AuthAction validates the
code_verifierby applying SHA-256 and comparing it with the originalcode_challengestored during authorization. - If valid, tokens are issued.
- AuthAction validates the
Limitations
Section titled “Limitations”- The
plaincode challenge method is not supported. Usecode_challenge_method=S256for all authorization requests.