Hi, I would like to add Google Login to my app and have implemented “AuthSession” from Expo. If I run my app through “Expo Go” everything works. I get redirected to Expo Auth and also get back into the app.
But as soon as I upload the app to Apple TestFlight, or use “expo-dev-client”, I only get the following error message and nothing happens.
Error:
Possible Unhandled Promise Rejection (id: 5):
Error: Cannot prompt to authenticate until the request has finished loading.
My Code:
import { FontAwesome } from "@expo/vector-icons";
import * as Google from "expo-auth-session/providers/google";
import { maybeCompleteAuthSession } from "expo-web-browser";
import { useEffect } from "react";
import { Text, TouchableOpacity, View } from "react-native";
import { AuthScreenProps } from "../../types";
maybeCompleteAuthSession();
export function WelcomeScreen({ navigation }: AuthScreenProps<"Welcome">) {
const [request, response, promptAsync] = Google.useAuthRequest({
expoClientId: "EXPO GOOGLE CLIENT ID",
iosClientId: "IOS GOOGLE CLIENT ID",
androidClientId: "ANDROID GOOGLE CLIENT ID",
webClientId: ''
});
useEffect(() => {
if (response?.type === "success") {
const { authentication } = response;
}
}, [response]);
return (
<View>
<TouchableOpacity onPress={async () => promptAsync({ showInRecents: true })}>
<View>
<FontAwesome name={"google"} size={24} color={"black"} />
<Text style={{ marginLeft: 8, fontSize: 20, color: "black", fontWeight: "600" }}>
Continue with Google
</Text>
</View>
</TouchableOpacity>
</View>
);
}
Does anyone have any idea what the problem is?