Auth session sometimes ends with "Something went wrong trying to finish signing in."
See original GitHub issueMaintainer edit
For production apps, it is preferable for your app to navigate to the third-party authentication provider directly instead of using this service. This is the official workaround to this issue, which is likely unresolvable due to how browser cookie policies have changed.
Configure the authentication provider to redirect directly to your app, typically with a deep link with your app’s own URL scheme. In your app, set the useProxy option to false (the default) when calling the promptAsync method, which configures your app not to use this service.
Due to web browser changes like WebKit’s Tracking Prevention, the AuthSession proxy service may not work reliably in edge cases such as when a user’s device is configured to block cookies or prevent cross-site tracking. The AuthSession proxy service does not track nor collect any user data but it requires cookies to correctly redirect back to your app after the user has authenticated with the third-party authentication provider. This service will not work if the browser’s settings or heuristics block cookies.
🐛 Bug Report
Summary of Issue (just a few sentences)
Sometimes when I try logging in using AuthSession it doesn’t redirect me back to app, but shows “Something went wrong trying to finish signing in.” instead. After that when I try again, it works as it should. After numerous tests we assume that this only happens on iOS, it never got reproduced on Android.
I am using expo since version 33, and this never happened before.
Environment - output of expo diagnostics & the platform(s) you’re targeting
Expo CLI 3.21.9 environment info:
System:
OS: macOS Mojave 10.14.4
Shell: 5.3 - /bin/zsh
Binaries:
Node: 10.16.1 - /usr/local/bin/node
Yarn: 1.15.2 - /usr/local/bin/yarn
npm: 6.9.0 - /usr/local/bin/npm
IDEs:
Xcode: 10.2.1/10E1001 - /usr/bin/xcodebuild
npmPackages:
expo: ^37.0.0 => 37.0.11
react: 16.9.0 => 16.9.0
react-dom: 16.9.0 => 16.9.0
react-native: https://github.com/expo/react-native/archive/sdk-37.0.1.tar.gz => 0.61.4
npmGlobalPackages:
expo-cli: 3.21.9
Target env: Android & iOS
Reproducible Demo
All I’m doing is:
const {
data: { redirect_url: redirectUrl }
} = yield ApiClient.get(`app.auth.${socialLoginSite}`); // fetch redirect url from backend, for google or facebook
const result = yield AuthSession.startAsync({
authUrl: redirectUrl
}); // Everything happens in this call
Steps to Reproduce
Try logging in using facebook or google, for some reason sometimes the final redirect doesn’t work.
Expected Behavior vs Actual Behavior
Expected Behavior: If there is an error, then AuthSession should return with
{
result: {
type: "error"
...
}
}
Actual Behavior: AuthSession gets blocked on last step and both users and developers are confused.
Issue Analytics
- State:
- Created 3 years ago
- Reactions:9
- Comments:70 (30 by maintainers)
Top Related StackOverflow Question
For future reference, I hit this error today when I misused the proxy.
This caused the auth to open up to the provider (e.g. facebook.com) but redirect to the proxy
auth.expo.iowhen it was complete. The error was the result of the auth proxy not being able to complete the result because I forgot to start it.I can confirm that we managed to overcome this by not using the proxy in the production or better said when not using the expo client. We confirmed that the no-proxy solution works with the clients where we were able to reproduce the problem. We kept the proxy for expo client as it’s easier to handle dev and integration stages like this, but you can also fully move to no-proxy solution.
In addition, we had to move away from
AuthSession.startAsynctoAuthSession.loadAsyncandAuthRequest.promptAsync. The reason is that we needed to supply correct information about proxy usage to bothmakeRedirectUriandpromptAsync…Basically this worked for us: