React native 无法从web视图获取控制权以在OAuth流中响应本机应用程序

React native 无法从web视图获取控制权以在OAuth流中响应本机应用程序,react-native,oauth-2.0,react-native-android,appauth,React Native,Oauth 2.0,React Native Android,Appauth,我正在尝试在我的react原生android应用程序中使用FormidableLab的库实现Google OAuth 2 signin,如下所示: googleLoginPressed = async () => { const config = { serviceConfiguration: { authorizationEndpoint: 'https://accounts.google.com/o/oauth2/v2/auth', tokenE

我正在尝试在我的react原生android应用程序中使用FormidableLab的库实现Google OAuth 2 signin,如下所示:

  googleLoginPressed = async () => {
    const config = {
      serviceConfiguration: {
        authorizationEndpoint: 'https://accounts.google.com/o/oauth2/v2/auth', tokenEndpoint: 'https://accounts.google.com/o/oauth2/v2/auth', 
      },
      clientId: app_params.GOOGLE_CLIENT_ID, redirectUrl: 'https://<my_domain>/oauth/google',
      scopes: ['openid', 'profile', 'email'], additionalParameters: { 'response-type': 'code' },
    };
    try {
      const result = await authorize(config);
    } catch (error) {
      console.log(error);
    }
  }
到目前为止我试过什么

  • 我确保我的应用程序可以打开
    通用链接
    。所以你一定工作得很好
  • 还尝试在iOS上复制整个设置。同样的结果。webview显示Google正确重定向到oauth端点,但应用程序无法恢复控制

如何从oauth web视图获得对react本机代码的控制权?

如果您使用的是声明的HTTPS方案,这是移动应用程序最推荐的安全选项,那么登录后您可能还需要一个间隙页面,以触发通用链接

My提供了更多信息和可以运行的代码示例,尽管它使用的是纯Kotlin而不是React Native

  @Override
  public void onNewIntent(Intent intent) { // this is not getting hit
    super.onNewIntent(intent);
    Uri appLinkData = intent.getData();

    if (appLinkData != null) {
      bar = appLinkData.getPath();
    }
  }