nuxt-modules / supabase

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

How to make the oauth callback work with deep link? #428

Closed HuakunShen closed 1 month ago

HuakunShen commented 1 month ago

I am trying to use this module in a desktop app with Tauri, through deep link. I experimented with the same route with http and a custom deep link scheme, the http one successfully authenticated, but failed with deep link.

Example

HuakunShen commented 1 month ago

I tried to use supabase.auth.exchangeCodeForSession(route.query.code) to manually authenticate with code, but got error: invalid request: both auth code and code verifier should be non-empty

code verifier somehow doesn't exist.

HuakunShen commented 1 month ago

Problem solved. The ?code=xxxx still couldn't be handled automatically, but supabase.auth.exchangeCodeForSession(route.query.code) works now.

I found that I have to initiate signin from the desktop app using supabase.auth.signInWithOAuth(). What I did previously was initiating signin from a regular web app and redirect to desktop app using deep link, but without supabase.auth.signInWithOAuth() from desktop app, the verify request will be missing code verifier