© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
SupabaseS
Supabase•4y ago
Noah

NextJS getServerSideProps capture Google login callback

I use Next.js with
@supabase#0835/auth-helpers-nextjs
@supabase#0835/auth-helpers-nextjs
with Google Auth. This is the flow that's happening after a user logs in with Google:

- I get a callback request from Google that contains the access token
- gSSP in Next sees that we’re not yet authenticated (because I have a check for protected pages)
- This check redirects to login page
- Client side Supabase sees access token and authenticates us
- Manual reload required to get away from login page to dashboard

The problem I see is that the Supabase client side JS deals with the callback coming from Google. That way the
getUser
getUser
in my gSSP still thinks I'm unauthenticated. What's the most elegant way to immediately be let through to my protected page on the Google callback?

For example, is there a
onAuthenticated
onAuthenticated
callback in the Supabase JS client I can use to redirect on client after Supabase has parsed the token?
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

Similar Threads

Was this page helpful?
Recent Announcements

Similar Threads

google auth on nextjs
SupabaseSSupabase / help-and-questions
4y ago
Google OAuth always returns 500 error on /auth/v1/callback after login
SupabaseSSupabase / help-and-questions
7mo ago
Python Google Login Help
SupabaseSSupabase / help-and-questions
4y ago
Google auth login issue
SupabaseSSupabase / help-and-questions
3mo ago