gpt4 book ai didi

react-native - Expo-Auth session 无法正常工作

转载 作者:行者123 更新时间:2023-12-05 05:38:55 29 4
gpt4 key购买 nike

在使用 expo-auth-session 包实现 google 登录时,我遇到了一些我不知道的错误,自从我陷入困境以来已经超过一天了这个问题我找不到可靠的来源用于在我的博览会应用程序中实现谷歌登录。有没有其他方法可以在 React Native Expo 应用程序中实现它。

我得到的错误是:

 WARN  Linking requires a build-time setting `scheme` in the project's Expo config (app.config.js or app.json) for production apps, if it's left blank, your app may crash. The scheme does not apply to development in the Expo client but you should add it as soon as you start working with Linking to avoid creating a broken build. [Learn more][1]: 
WARN EventEmitter.removeListener('url', ...): Method has been deprecated. Please instead use `remove()` on the subscription returned by `EventEmitter.addListener`.
WARN Possible Unhandled Promise Rejection (id: 2):
Error: Exception in HostFunction: Malformed calls from JS: field sizes are different.

我该怎么办??link我遵循的文档是:-

这是我从文档中使用的内容。

import * as Google from "expo-auth-session/providers/google";

import * as WebBrowser from "expo-web-browser";
WebBrowser.maybeCompleteAuthSession();


const [request, response, promptAsync] = Google.useAuthRequest({
expoClientId: expoClientId,
});


const login = ()=>{
useEffect(() => {
if (response?.type === "success") {
const { authentication } = response;
console.log(authentication);
}
}, [response]);

return (

<Pressable style={styles.btn} onPress={promptAsync}>
<Image
source={require("../../../assets/g1.png")}
style={styles.img}
/>
<Text style={styles.text}>Sign in with Google</Text>
</Pressable>

)
}

谢谢您的帮助。

最佳答案

在你的 app.json 添加以下内容

"scheme":"com.yourpackage.yourapp"

此值必须与您的 android.package 和 ios.bundleIdentifier 相同

关于react-native - Expo-Auth session 无法正常工作,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/72814427/

29 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com