[英]Firebase auth/operation-not-allowed for google signin
In React native App在 React 原生应用中
I'm trying to authenticate google signIn using firebase.我正在尝试使用 firebase 对谷歌登录进行身份验证。
In my firebase console > Authentication > signIn Method, I've enabled the google and saved it.在我的 firebase 控制台 > 身份验证 > 登录方法中,我启用了 google 并保存了它。 Click here to view image.
单击此处查看图像。
But when I try to login It throws me an error saying that auth/operation-not-allowed但是当我尝试登录时,它会抛出一个错误,说 auth/operation-not-allowed
import Auth, { firebase } from '@react-native-firebase/auth';
import { GoogleSignin } from "@react-native-community/google-signin";
const {idToken} = await GoogleSignin.signIn();
const googleCredential = Auth.GoogleAuthProvider.credential(idToken);
return await Auth().signInWithCredential(credential);
And I have got error like我有错误
Error: [auth/operation-not-allowed] The given sign-in provider is disabled for this Firebase project. Enable it in the Firebase console, under the sign-in method tab of the Auth section. [ The identity provider configuration is disabled. ]
NativeFirebaseError: [auth/operation-not-allowed] The given sign-in provider is disabled for this Firebase project. Enable it in the Firebase console, under the sign-in method tab of the Auth section. [ The identity provider configuration is disabled. ]
at FirebaseAuthModule.signInWithCredential (http://localhost:8081/index.bundle?platform=android&dev=true&minify=false:154406:28)
at signInWithCredential$ (http://10.0.2.2:8081/src/Utils/Auth.bundle?platform=android&dev=true&minify=false&modulesOnly=true&runModule=false&shallow=true:84:68)
at tryCatch (http://localhost:8081/index.bundle?platform=android&dev=true&minify=false:24976:19)
at Generator.invoke [as _invoke] (http://localhost:8081/index.bundle?platform=android&dev=true&minify=false:25149:24)
at Generator.next (http://localhost:8081/index.bundle?platform=android&dev=true&minify=false:25019:23)
at tryCatch (http://localhost:8081/index.bundle?platform=android&dev=true&minify=false:24976:19)
at invoke (http://localhost:8081/index.bundle?platform=android&dev=true&minify=false:25049:22)
at http://localhost:8081/index.bundle?platform=android&dev=true&minify=false:25079:13
at tryCallTwo (http://localhost:8081/index.bundle?platform=android&dev=true&minify=false:27065:7)
It looks like you haven't enabled the Google sign in method in your firebase console.您似乎尚未在 firebase 控制台中启用 Google 登录方法。 To solve the issue do the following:
要解决此问题,请执行以下操作:
It is probable that you'll have to configure a secure project ID (you'll see a dropdown below the enable button).您可能必须配置一个安全的项目 ID(您会在启用按钮下方看到一个下拉菜单)。 What you have to do is, enter the android and/or ios client ID from your project, and hit save.
您需要做的是,从您的项目中输入 android 和/或 ios 客户端 ID,然后点击保存。 This will tell firebase that it is secure to handle sign in operations with that client.
这将告诉 firebase 使用该客户端处理登录操作是安全的。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.