小编Jul*_*ian的帖子

Expo Auth Session 实施的问题

我在实施 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 登录,但是当我重定向到应用程序时,响应解析为 …

oauth react-native expo

8
推荐指数
1
解决办法
2万
查看次数

标签 统计

expo ×1

oauth ×1

react-native ×1