© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
SupabaseS
Supabase•6mo ago•
2 replies
mike

OAuth PKCE documentation needs an update for `createClient`

I was attempting to use the PKCE flow for google OAuth login but kept getting a result where the supabase auth endpoint would redirect to my url with an access token and other values at
<redirecturl>#<values>
<redirecturl>#<values>
, and there was no code to exchange but it had a supabase access token.

After debugging and digging through mounds of issues and examples, I found that I needed to set a config option when using
createClient
createClient
from the
@supabasejs/supabase-js
@supabasejs/supabase-js
library. This tells the
auth
auth
to use the pkce flow:

import { createClient } from '@supabase/supabase-js';
createClient( <supabaseUrl>, <supabaseAnonKey>, { auth: { flowType: 'pkce' } })
import { createClient } from '@supabase/supabase-js';
createClient( <supabaseUrl>, <supabaseAnonKey>, { auth: { flowType: 'pkce' } })


None of the examples in the high-level OAuth documentation or facebook/google oauth docs said this needed to be done, and all the posts and issues I found did not mention anything about this (maybe because most of them are using
createServerClient
createServerClient
from the ssr package?).

I did finally end up on this page of the js client docs and found the configuration.

The most confusing part of all of this is that none of the other pkce flows for internal authentication required this configuration. E.g., registration, magiclink, email and phone verification all worked with the OTP.
JavaScript: Exchange an auth code for a session | Supabase Docs
Supabase API reference for JavaScript: Exchange an auth code for a session
JavaScript: Exchange an auth code for a session | Supabase Docs
Supabase banner
SupabaseJoin
Supabase gives you the tools, documentation, and community that makes managing databases, authentication, and backend infrastructure a lot less overwhelming.
45,816Members
Resources
Was this page helpful?

Similar Threads

Recent Announcements

Similar Threads

Need Supabase OAuth documentation
SupabaseSSupabase / help-and-questions
8mo ago
OAuth provider metadata documentation
SupabaseSSupabase / help-and-questions
4y ago
Documentation for createClient doesn't match implementation? Bug in GoTrueClient.js?
SupabaseSSupabase / help-and-questions
4y ago
Azure OAuth PKCE Error with Single-Tenant Configuration
SupabaseSSupabase / help-and-questions
2mo ago