vercel / nextjs-subscription-payments

Clone, deploy, and fully customize a SaaS subscription application with Next.js.
https://subscription-payments.vercel.app/
MIT License
6.08k stars 1.23k forks source link

With `google` for supabase auth, `No storage option exists to persist the session` problem #199

Closed carbone-stone closed 1 year ago

carbone-stone commented 1 year ago

With the latest version, auth seems to be a bit of a problem if I use google for Auth:

      <Auth
        supabaseClient={supabase}
        providers={['google']}
        redirectTo={getURL()}
        magicLink={true}
        appearance={{
          theme: ThemeSupa,
          variables: {
            default: {
              colors: {
                brand: '#404040',
                brandAccent: '#52525b'
              }
            }
          }
        }}
        theme="dark"
      />

I get this problem when creating a product from Stripe:

No storage option exists to persist the session, which may result in unexpected behavior when using auth.
        If you want to set persistSession to true, please provide a storage option or you may set persistSession to false to disable this warning.

I think this is something to do with getSession:

export async function middleware(req: NextRequest) {
  const res = NextResponse.next()
  const supabase = createMiddlewareClient<Database>({ req, res })
  await supabase.auth.getSession()
  return res
}

How can we persist session when auth is changed with Google?

Forgive my naive question

jparismorgan commented 1 year ago

@carbone-stone what was your solution to this? I am also seeing this error on some pages and API calls.

ilaffey2 commented 1 year ago

+1 ^