I am trying to logon to my app with Google (Expo).
I have tried different settings in config with no luck. I am being redirected to Google, and not back to my app.
Login.js:
import React, { useEffect } from "react";
import * as WebBrowser from "expo-web-browser";
import * as Google from "expo-auth-session/providers/google";
import * as AuthSession from "expo-auth-session";
import AsyncStorage from "@react-native-async-storage/async-storage";
import { useYukiContext } from "../../provider";
import { Button, View } from "react-native";
const webClientId =
"...secret";
const iosClientId =
"...secret";
const androidClientId =
"...secret";
WebBrowser.maybeCompleteAuthSession();
export default function LoginGoogle() {
const { setMail, setFullName, setIsLoggedIn, mobileUniqueID } =
useYukiContext();
const config = {
androidClientId,
iosClientId,
webClientId,
};
const [request, response, promptAsync] = Google.useAuthRequest(config);
useEffect(() => {
handleSignIn();
}, [response]);
async function handleSignIn() {
if (response?.type === "success") {
alert(response?.authentication?.accessToken);
}
}
return (
<View
style={{
flex: 1,
backgroundColor: "black",
borderRadius: 5,
width: 200,
justifyContent: "center",
alignItems: "center",
marginTop: 15,
}}
>
<Button
color={"black"}
title="Logg inn med Google"
onPress={() => promptAsync()}
/>
</View>
);
}
I have also added scheme "yukiapp" to app.json
Expected solution: Login to Google and return to the app Whats happening: Opens Google, logging in, loading, and redirects to Google
I have used this guide:
I have Googled this issue, and some are saying the bundleIdentifier/package must be in lower case.. Some say that I have to include "IntentFilters"..