Helped me through, despite not being the same problem the use the URL quote helped me solve this by changing a bit how I thought about it!
The final result became a little too big to paste here, but the handling ended up being relatively straightforward:
useEffect(() => { if (result?.type === "success") { const { token, iv } = getParamsFromUrl(result.url) const session = decrypt(token, key, iv) console.log({ session }) } }, [result])
Videos
Update: found the issue. It was caused by the discovery failing silently. The example code is not well engineered here. There should be a check (even in the example) that detects errors when doing the discovery part.
If you are encountering this, make sure the actual endpoint URL delivered to the auth mechanism is actually set from the discovery.
In My case it was like missing scheme. After adding it worked in expo go
{
"expo": {
"scheme": "your-app-slug"
}
}
» npm install expo-auth-session
Is there any way to authenticate through Google using webview or expo-web-browser?
Because I don't want to touch the native files (ios - android)
Try this:
-Login to your expo account: on command line type:
expo login
##then your account credencials##
then restart your expo instance:
expo start
And everything should work fine
I have the exact same issue. I've posted on the Expo forums too and tried to contact the devs about it but nobody's responding to me. I think it's been broken with a recent change. If you look at the redirect URL it's supposed to have two more query parameters one for the authentication URL and one for the return URL
Update 2: For anyone who comes across this later, the solution to get it all working nicely was adding ‘createTask: false’ in the options of the auth request (keeps the auth browser alive and in the same instance) plus “experimentalLauncherActivity: true” in the app.config for expo-web-browser (for re-opening app via the icon).
Update: It seems to be an issue with expo-web-browser itself rather than auth specifically. Tested opening a simple web page with expo-web-browser and when going to the app switcher it dismisses that opened web page instance.
This Expo PR seems to suggest it's fixed (and can see these changed in my node_modules), but isn't working for me.
-------------------------------------------------------------
We have implemented our authentication using 'expo-auth-session' that then opens up an Azure auth page to register/sign in.
The issue is that on Android, if you press ||| to go to the app switcher (e.g. when going to email app to get verification code), the auth webview window (which appears as a new 'app instance' in the switcher) gets automatically dismissed immediately on press of the ||| button.
It animates upwards as if it were swiped away, so doesn't seem to be crashing but deliberately dismissing.
iOS behaves perfectly fine, the auth webview page seems to open up within the same 'app instance' and remains there.
Tried the `experimentalLauncherActivity": true` option from the docs but that didn't seem to help at all.
Any ideas?