I’ve been trying to set up SignIn with google on my react native app, and after implementing the code below, every time I launched the web browser the Google web browser would generate the error: “Access blocked: Authorization error. You can’t sign in to this app because it doesn’t comply with Google’s OAuth 2.0 policy for keeping apps secure.”
import React, { useState, useEffect } from "react";
import {
View,
Button,
} from "react-native";
import * as Google from 'expo-auth-session/providers/google'
export default function LoginBox({ navigation }) {
const [accessToken, setAccessToken] = React.useState();
const [request, response, promptAsync] = Google.useAuthRequest({
expoClientId: 'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.apps.googleusercontent.com',
iosClientId: 'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.apps.googleusercontent.com',
})
useEffect (() => {
if (response?.type === 'success') {
setAccessToken(response.authentication.accessToken)
}
}, [response])
const getUserData = () => {
}
return (
<View style={{backgroundColor: 'white'}}>
<Button title={accessToken ? "Get User Data": "Login"}
onPress={accessToken ? getUserData : () => promptAsync({useProxy: 'true', showInRecents: 'true' })}
/>
</View>
);
}
I thought the issue might be with my redirect URI, which is Sign-in Complete, and my authorized JavaScript origins are https://auth.expo.io, but I am not sure.