我是 React Native 和 Expo 的新手,很难弄清楚这段代码。我已经尝试了在 Google 和 StackOverflow 上能找到的所有方法。在 Expo Go 应用程序中的 IOS 设备上运行该应用程序,当我单击“登录”按钮时,出现以下错误。已在 Google 开发者控制台上验证重定向 uri:https://auth.app.expo.io/@devname/AppLock AppLock 是我的 app.json 文件中的 Slug
访问被阻止:授权错误 您无法登录此应用,因为它不符合 Google 保护应用安全的 OAuth 2.0 政策。 您可以让应用开发者知道此应用不符合一项或多项 Google 验证规则。 错误400:Invalid_request请求 详细信息:redirect_uri=exp://192.168.50.112:8081
import { AuthRequestConfig, makeRedirectUri, useAuthRequest, useAutoDiscovery } from 'expo-auth-session';
import * as WebBrowser from 'expo-web-browser';
import * as Google from 'expo-auth-session/providers/google';
const googleWebClientId = 'webClientId';
const iosClientId = 'iosClientId';
const EXPO_REDIRECT_PARAMS = { useProxy: true, scheme: 'AppLock' };
const app = () => {
WebBrowser.maybeCompleteAuthSession();
const [user, setUser] = useState(null);
const [request, result, promptAsync] = Google.useAuthRequest({
iosClientId: iosClientId,
webClientId: googleWebClientId,
scopes: ['openid','email'],
redirectUri: makeRedirectUri(EXPO_REDIRECT_PARAMS)
});
useEffect(() => {
console.log(request);
console.log(result);
}, []);
useEffect(() => {
console.log('in the hook!');
console.log(request);
console.log(result);
}, [request, result]);
return (
<View>
{user && (
<Text>
Welcome, {user.displayName}!
</Text>
)}
<Text>Hello!</Text>
<Text>There!</Text>
<Button title="Sign in with Google" disabled={!request} onPress={() => promptAsync()} />
</View>
);
};
export default app;
此问题有任何更新吗?我也面临这个错误。