supabase icon indicating copy to clipboard operation
supabase copied to clipboard

Google auth integration with Capacitor for IOS

Open 93lucasp opened this issue 2 years ago • 6 comments

Hello i have the same of this guy https://stackoverflow.com/questions/75671811/supabase-google-auth-integration-with-capacitor-react-for-ios

When i try to signin with google on the browser i don't have any problem, but when i try on mobile, it is opening the browser, is doing the login with google but when redirect on the app again the user is not loogged in.

I have setup my deep linking with capacitor correctly, the problem is that when it redirect on my app after the redirect of google it doesn't keep my session and the user is not logged. This is happening not only for google but also with Github. This is happening only on the app mobile.

This is my code to login:

async function signinGoogle(event) {
  event.preventDefault();
  try {
    await supabase.auth.signInWithOAuth({
      provider: "google",
      options: {
        queryParams: {
          access_type: "offline",
          prompt: "consent",
        },
      },
    });
  } catch (error) {
    console.log(error);
  }
}

this is in my nuxt config:

modules: ['@nuxtjs/supabase'],
  supabase: {
    redirect: false,
    cookieOptions: {
      maxAge: 60 * 60 * 8,
      sameSite: 'lax',
      secure: true
    },
    clientOptions: {
      auth: {
        flowType: 'pkce',
        detectSessionInUrl: true,
        persistSession: true,
        autoRefreshToken: true
      },
    }
  },

and this is the event of capacitor:

App.addListener("appUrlOpen", function (event: URLOpenListenerEvent) {
  const router = useRouter();
  const slug = event.url.split(".app").pop();
  // We only push to the route if there is a slug present
  if (slug) {
    router.push(slug);
  }
});

I followed this: https://capacitorjs.com/docs/guides/deep-links btw as i said is working the deep linking because it is working as expected.

Any help?

93lucasp avatar Oct 04 '23 08:10 93lucasp

Same issue here. Did you figure it out?

luisfnicolau avatar Feb 04 '24 21:02 luisfnicolau

experiencing something very similar atm, did someone figure out what's the matter?

IosifPuha avatar May 23 '24 17:05 IosifPuha

having the same issue, did anyone figure this out?

StockBet avatar Jun 23 '24 10:06 StockBet