© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
SupabaseS
Supabase•4mo ago•
32 replies
John

Cannot redirect to redirectTo url when using the signInWithOAuth function

using @supabase/ssr

"use client";

import { createClient } from "@/utils/supabase/client";

export default function GoogleButton() {
  async function signInWithGoogle() {
    const supabase = createClient();

    const { data, error } = await supabase.auth.signInWithOAuth({
      provider: "google",
      options: {
        redirectTo: 'https://example.com/welcome',
      }
    });

    if (error) {
      console.error("Google sign-in error:", error.message);
    }
  }

  return <button onClick={signInWithGoogle}>Sign in with Google</button>;
}
"use client";

import { createClient } from "@/utils/supabase/client";

export default function GoogleButton() {
  async function signInWithGoogle() {
    const supabase = createClient();

    const { data, error } = await supabase.auth.signInWithOAuth({
      provider: "google",
      options: {
        redirectTo: 'https://example.com/welcome',
      }
    });

    if (error) {
      console.error("Google sign-in error:", error.message);
    }
  }

  return <button onClick={signInWithGoogle}>Sign in with Google</button>;
}


import { createBrowserClient } from '@supabase/ssr'

export function createClient() {
  return createBrowserClient(
    process.env.NEXT_PUBLIC_SUPABASE_URL!,
    process.env.NEXT_PUBLIC_SUPABASE_ANON_KEY!
  )
}
import { createBrowserClient } from '@supabase/ssr'

export function createClient() {
  return createBrowserClient(
    process.env.NEXT_PUBLIC_SUPABASE_URL!,
    process.env.NEXT_PUBLIC_SUPABASE_ANON_KEY!
  )
}


the login with password one works fine, but this one does not

I followed the guide for server side auth, and I can't get this client side oauth with google to work. For redirect, I've tried everything but it just defaults to the default that I had set in supabase. When I had this prior fully client side (with no server side auth), it worked. No idea how to fix this and help would be appreciated, thanks
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

signInWithOAuth redirect to not working as expected
SupabaseSSupabase / help-and-questions
4y ago
Update scopes using signInWithOAuth?
SupabaseSSupabase / help-and-questions
12mo ago
signInWithOAuth is not a function error.
SupabaseSSupabase / help-and-questions
4y ago
Creating edge function for redirect url to deep link
SupabaseSSupabase / help-and-questions
4y ago