This is a standalone HTML test page for verifying PKCE OAuth flow with Supabase.
-
Copy the example configuration:
cp test-pkce-config.example.js test-pkce-config.js
-
Add your Supabase credentials:
Open
test-pkce-config.jsand replace the placeholder values:const TEST_SUPABASE_CONFIG = { url: 'https://your-project-id.supabase.co', // Your Supabase project URL anonKey: 'eyJhbGc...' // Your Supabase anon/public key };
-
Open the test page:
Open
test-pkce-client.htmlin your browser (you can use a local server or just open the file directly).
⚠️ DO NOT committest-pkce-config.jswith real credentials- The file
test-pkce-config.jsis git-ignored to prevent accidental commits - Only the example file (
test-pkce-config.example.js) is committed to the repository - The anon key is safe to use in public clients but should still not be hardcoded in committed files
By default, the test page does not log sensitive values (authorization codes, access tokens, etc.) to protect against accidental exposure.
To enable detailed logging for debugging:
- Open
test-pkce-client.html - Find the
VERBOSE_LOGGINGconstant (around line 57) - Change
const VERBOSE_LOGGING = false;toconst VERBOSE_LOGGING = true; - Remember to set it back to
falsebefore committing or sharing
When VERBOSE_LOGGING = false (default):
- ✅ Authorization codes and tokens are redacted from logs
- ✅ Sensitive data shows as
[REDACTED]in output - ✅ Only success/failure status is logged
When VERBOSE_LOGGING = true:
⚠️ Full authorization codes and tokens are logged to console⚠️ Sensitive data visible in output panels⚠️ Use only for local debugging, never in production
- Click "Test Google OAuth (PKCE)" to initiate the OAuth flow
- Check the Network tab in DevTools for the authorization URL - it should contain:
code_challenge=...code_challenge_method=S256
- After authentication, the redirect URL should be:
- ✅
/test-pkce-client.html?code=...(query parameter) - ❌ NOT
/test-pkce-client.html#access_token=...(hash fragment)
- ✅
- Click "Check SessionStorage" to verify the PKCE code verifier is stored
- Click "Clear Storage" to reset for another test
- ✅ PKCE flow configuration
- ✅ Code verifier generation and storage
- ✅ Authorization code exchange
- ✅ Proper OAuth redirect flow
- ✅ No tokens in URL (security)
"Configuration Missing" error:
- Make sure you've created
test-pkce-config.jsfrom the example file
"Invalid Configuration" error:
- You need to replace the placeholder values in
test-pkce-config.jswith your actual Supabase credentials
OAuth flow shows #access_token=... instead of ?code=...:
- This means PKCE is not enabled. Check your Supabase dashboard settings and client configuration.