nuxt-modules / supabase

Supabase module for Nuxt.
https://supabase.nuxtjs.org
MIT License
733 stars 129 forks source link

Google auth integration with Capacitor for IOS #284

Open 93lucasp opened 1 year ago

93lucasp commented 1 year ago

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?

luisfnicolau commented 9 months ago

Same issue here. Did you figure it out?

IosifPuha commented 5 months ago

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

StockBet commented 4 months ago

having the same issue, did anyone figure this out?