Expo Auth Session 实施的问题

Jul*_*ian 8 oauth react-native expo

我在实施 Expo Auth Session 时遇到问题。

我正在尝试在 Expo Auth 会话中使用 Google Oauth 登录,如下所述: https: //docs.expo.io/guides/authentication/#google

WebBrowser.maybeCompleteAuthSession();

const GoogleButton = () => {
  // Endpoint
  const discovery = useAutoDiscovery('https://accounts.google.com');

  // Request
  const [request, response, promptAsync] = useAuthRequest(
    {
      clientId: 'MYID',
      scopes: ['email', 'profile'],
      // For usage in managed apps using the proxy
      redirectUri: makeRedirectUri({
        // For usage in bare and standalone
        native: 'com.googleusercontent.apps.MYID://redirect',
        useProxy: true,
      }),
    },
    discovery,
  );

  console.log(request);
  console.log(response);

  return (
    <Button
      onPress={promptAsync}
      icon={GoogleIcon}
    />
  );
};
Run Code Online (Sandbox Code Playgroud)

浏览器打开,我可以成功使用 google 登录,但是当我重定向到应用程序时,响应解析为Object { "type": "dismiss", }

我还尝试使用不同的 oauth 服务来实现 oauth:

WebBrowser.maybeCompleteAuthSession();

const HiveButton = () => {
  // Endpoint
  const discovery = {
    authorizationEndpoint:
      'https://hivesigner.com/login-request/my.app',
  };

  // Request
  const [request, response, promptAsync] = useAuthRequest(
    {
      scopes: ['posting'],
      // For usage in managed apps using the proxy
      redirectUri: makeRedirectUri({
        useProxy: true,
      }),
    },
    discovery,
  );

  console.log(request);
  console.log(response);

  return (
    <Button
      onPress={promptAsync}
      icon={HiveIcon}
    />
  );
};
Run Code Online (Sandbox Code Playgroud)

浏览器打开,我可以成功登录,但我没有被重定向到应用程序,而是收到“尝试完成登录时出错。请关闭此屏幕以返回应用程序。” 在 auth.expo.io/@me/myapp 上,即使参数代码具有我想要传递给我的应用程序的正确登录令牌。

Sea*_*ary 0

我有完全相同的问题。我也在世博会论坛上发帖,并尝试联系开发人员,但没有人回复我。我认为最近的更改已经破坏了它。如果您查看重定向 URL,它应该还有两个查询参数,一个用于身份验证 URL,另一个用于返回 URL