与标题中一样,在调用GoogleSignin.signIn()
时, idToken 和 accessToken 值都为空代码(与here中的示例相同:
export async function googleLogin() {
try {
// add any configuration settings here:
await GoogleSignin.configure();
const data = await GoogleSignin.signIn();
google-services.json文件已就位,并且之前运行良好。从react-native 0.59.9迁移到0.61.5后,我在构建应用程序时遇到一些问题,现在应用程序启动了,主要问题是GoogleSignin的新值
库版本:
"@babel/runtime": "7.7.7",
"@react-native-community/google-signin": "3.0.3",
"react": "16.12.0",
"react-native": "0.61.5",
"react-native-camera": "3.15.0",
"react-native-device-info": "5.4.0",
"react-native-eject": "0.1.2",
"react-native-firebase": "5.6.0",
"react-native-gesture-handler": "1.5.2",
"react-native-permissions": "2.0.8",
"react-native-progress": "4.0.3",
"react-native-qrcode-scanner": "1.3.1",
"react-native-qrcode-svg": "6.0.1",
"react-native-responsive-fontsize": "0.4.2",
"react-native-simple-toast": "1.0.0",
"react-native-svg": "9.13.6",
"react-native-svg-uri": "1.2.3",
"react-navigation": "4.0.10",
"react-navigation-stack": "^1.10.3",
"react-stomp": "4.2.0"
答案 0 :(得分:0)
您需要在GoogleSignin.configure()
中传递您的 webClientId 。
GoogleSignin.configure({
webClientId: 'xxxxxxxxxxxx-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx.apps.googleusercontent.com'
})
此外,当组件正在调用configure
时,也不应调用signIn()
方法,因为在调用SignIn()
之前需要完成配置。
尝试在导入后或在构造函数中或在 useEffect
最后,您应该查看[Social Authentication Firebase] [1]上的更新文档。 [1]:https://rnfirebase.io/auth/social-auth
我为此付出了很多努力。 希望对您有帮助