I am new to React Native and Expo and having hard time figuring out this piece of code. I have tried everything I could find on Google and StackOverflow. Running the app on a IOS device in Expo Go app and when I click on "Sign In" button I am getting the below error. Have verified the redirect uri on Google developer console as: https://auth.app.expo.io/@devname/AppLock AppLock is the Slug in my app.json file
Access blocked: Authorzation Error You can't sign in to this app because it does not comply with Google's OAuth 2.0 policy for keeping apps secure. You can let the app developer know that this app doesn't comply with one or more Google validation rules. Error 400: Invalid_request Request details: 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;