admin管理员组文章数量:1321045
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"..
本文标签: react nativeGoogle Auth 400 invalidrequest or redirected to GooglecomStack Overflow
版权声明:本文标题:react native - Google Auth 400 invalid_request or redirected to Google.com - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1742091241a2420278.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论