可能的未置信的承诺拒绝(ID:1)
我试图使用React Native的Expo使用Google API Auth,当我尝试登录API时,我会收到下一个错误:
代码:
import React, { createContext,useContext } from 'react'
import * as Google from 'expo-google-app-auth';
const AuthContext = createContext({})
const config = {
androidClientId : 'APIKey',
iosClientId: 'APIKey',
scope: ["profile", "email"],
premissions : ["public_profile", "email","gender","location"],
}
export const AuthProvider = ({ children }) => {
const signInWithGoogle = async() => {
Google.logInAsync(config).then(async (logInResults) => {
if (logInResults.type === 'success') {
// login...
}
});
};
return (
<AuthContext.Provider
value={{
user:null,
signInWithGoogle
}}
>
{children}
</AuthContext.Provider>
)
}
export default function useAuth (){
return useContext(AuthContext)
}
错误:
:错误:iOS上没有方法或属性expo-app-auth.authasync,您确定已正确链接了所有本机依赖关系吗?]
I was trying to use the Google API auth from expo in react native and when I trying to log to the api , I getting the next error :
code :
import React, { createContext,useContext } from 'react'
import * as Google from 'expo-google-app-auth';
const AuthContext = createContext({})
const config = {
androidClientId : 'APIKey',
iosClientId: 'APIKey',
scope: ["profile", "email"],
premissions : ["public_profile", "email","gender","location"],
}
export const AuthProvider = ({ children }) => {
const signInWithGoogle = async() => {
Google.logInAsync(config).then(async (logInResults) => {
if (logInResults.type === 'success') {
// login...
}
});
};
return (
<AuthContext.Provider
value={{
user:null,
signInWithGoogle
}}
>
{children}
</AuthContext.Provider>
)
}
export default function useAuth (){
return useContext(AuthContext)
}
error :
and this command :
[Unhandled promise rejection: Error: The method or property expo-app-auth.authAsync is not available on ios, are you sure you've linked all the native dependencies properly?]
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论