expo: Deep link into app in Expo client does not close the Chrome Custom Tabs browser
š Bug Report
Environment
Android Expo client. This bug does not occur in Android standalone apps.
Steps to Reproduce
- Open a web browser with
WebBrowser.openBrowserAsync(url);
- Have that URL redirect back to your app (
Linking.makeUrl()
) - Notice that in Expo client for Android you need to manually close the browser by tapping the X button, but in a standalone app it closes as expected.
Expected Behavior
On Android because we cannot call WebBrowser.dismiss()
we depend on the browser window closing when we redirect back to the app.
Actual Behavior
The browser window only closes on redirect in standalone apps.
Reproducible Demo
import React from 'react';
import { Button, StyleSheet, Text, View } from 'react-native';
import { AuthSession } from 'expo';
const FB_APP_ID = '2232923493627585';
export default class App extends React.Component {
state = {
result: null,
};
render() {
return (
<View style={styles.container}>
<Button title="Open FB Auth" onPress={this._handlePressAsync} />
{this.state.result ? (
<Text>{JSON.stringify(this.state.result)}</Text>
) : null}
</View>
);
}
_handlePressAsync = async () => {
try {
let redirectUrl = AuthSession.getRedirectUrl();
let result = await AuthSession.startAsync({
authUrl:
`https://www.facebook.com/v2.8/dialog/oauth?response_type=token` +
`&client_id=${FB_APP_ID}` +
`&redirect_uri=${encodeURIComponent(redirectUrl)}`,
});
this.setState({ result });
} catch(e) {
alert(e.message);
}
};
}
const styles = StyleSheet.create({
container: {
flex: 1,
alignItems: 'center',
justifyContent: 'center',
},
});
(be sure to set a scheme
for the standalone app when testing there)
About this issue
- Original URL
- State: closed
- Created 5 years ago
- Reactions: 20
- Comments: 22 (9 by maintainers)
This should be resolving the issue: #4882
It will be published after SDK 35 is released.
År., 28 sie 2019 o 14:12 MichaÅ Matyas notifications@github.com napisaÅ(a):
I also see this issue in our standalone production android app, and itās preventing any android device from logging in with an
AuthSession
.Hereās what happens:
AuthSession.startAsync
.AuthSession
promise never returns.This was working fine in SDK 32, but is now broken in SDK 33. This is causing us to remove logging in on android with third party auth with
AuthSession
.Just tested on the android emulator with that expo .apk, works a treat, great job guys!
We cannot, temporarily, publish Expo Client update on Google Play Store. Could you please check this version and let us know if it works now?
Hey! Iāve just checked the issue, and the problem is that for some reason fix havenāt landed in newest Client version. However, when building standalone application it should work just fine. It is also included in expo-web-browser@6.0.0 for ejected and bare applications.
I am on releasing new version of client with that fix for SDK34.
Not in my testing iāve done, performs exactly the same as v33, which is not working. The promise resolves still in the background, but the chrome custom tab stays open until you physically tap to close it. I can see the code change in #4882 is in the v34 release though, so clearly that hasnāt fixed the issue. Just testing also opening the page with the app redirect link using āopen in chromeā and the pressing it from there, works straight away, so itās definitely the custom tab stuff thatās the issue.
So SDK34 doesnāt fix this? Weāre trying to meet the 8/1 deadline for 64-bit Android apps & having to close the Chrome window manually is not a good user experience.
@mczernek since the fix was merged, any chance you could bump the package version and release it so we could see if it solved the issue? Thanks! š
Well this is annoying! I thought with the release of SDK34 this would fix the issue⦠itās still an issue. You still have to close the chrome window manually and it doesnāt do it for you like it used to before this bug š¦
Is there a workaround for this?
Given that this seems to break our SSO workflow I guess thereās not way to finally upgrade to 33 at the moment š¦