auth-js
auth-js copied to clipboard
Feat/get session from url param
What kind of change does this PR introduce?
Achieves #208.
Allows the user to optionally pass a url manually. It appears this might have been originally intended from the looks of the code.
What is the current behavior?
Supabase/gotrue method only gets url from document url.
Capacitor native app webview does not seem to be able to get a token from a normal auth callback.
What is the new behavior?
Force capacitor to get the token by using url param in the getSessionFromUrl method.
if (Capacitor.isPluginAvailable('App')) { App.addListener('appUrlOpen', async urlOpen => { const { data, error } = await supabase.auth.getSessionFromUrl( { storeSession: true, }, urlOpen.url, ) }) }
Additional context
This is equivalent to the auth0 method listed here https://auth0.com/docs/quickstart/native/ionic-react/01-login
Would changing
|| null
to
|| undefined
fix the errors?
Hi, thank you for your contribution! The library has advanced quite a bit from then. I'll close this PR for now, but do open a new one if you would like the same change to appear in v2.