标签: firebase-authentication

如何增加 Firebase 身份验证限制?

我目前正在编写一个使用 Firebase 进行身份验证的项目。我进入这个状态:

帐户创建和删除限制

操作限额

新帐户创建 100 个帐户/IP 地址/小时

删除账户 10个账户/秒

这不可能是真的吧?我的意思是每小时 100 个新帐户的报价很低,对吧?Firebase 应该帮助项目快速扩展,为什么他们会如此限制新用户帐户?我可以做些什么来增加这个限制吗?

firebase firebase-authentication

1
推荐指数
1
解决办法
410
查看次数

如何查看从本地主机上的 Firebase 身份验证模拟器(Web)发送的确认电子邮件?

我正在本地主机端口 3000 上运行 Next.js 应用程序。通过 Firebase 电子邮件/密码注册,我可以auth().currentUser.sendEmailVerification();在 Firebase 身份验证模拟器运行的情况下发送电子邮件。在本地主机上进行开发期间,我希望能够拦截、查看电子邮件并单击重定向链接。

我一直在nodejs后端使用MailDev和Nodemailer来拦截从后端发送的电子邮件,但我一直无法找到如何对这些Firebase电子邮件执行类似的操作,例如将它们发送到MailDev,它正在接收电子邮件本地主机:1025

firebase firebase-authentication

1
推荐指数
1
解决办法
1857
查看次数

无法连接到 Firestore 数据库

尝试从 Firestore 获取文档及其字段时,出现以下错误:

来自本地主机:

@firebase/firestore: Firestore (8.3.2): Could not reach Cloud Firestore backend. Connection failed 1 times. Most recent error: FirebaseError: [code=permission-denied]: Permission denied on resource project "xxxxxxxxx".
This typically indicates that your device does not have a healthy Internet connection at the moment. The client will operate in offline mode until it is able to successfully connect to the backend.
Run Code Online (Sandbox Code Playgroud)

来自 Firebase 托管:

BrowserPollConnection.ts:728 GET https://[PROJECT_ID]-default-rtdb.firebaseio.com/.lp?start=t&ser=82934841&cb=1&v=5&p=1:303920306737:web:bc61250d7aa9a51a415310 net::ERR_NAME_NOT_RESOLVED
Run Code Online (Sandbox Code Playgroud)

当查找这个问题时,解决方案似乎是缓存、DNS、ISP、VPN 或类似的东西。我已经尝试了所有建议的解决方案,但仍然没有解决方案。我想这可能是我配置连接的方式?

我唯一觉得奇怪的是,它声明它试图访问https://[PROJECT_ID]-default-rtdb.firebaseio.com,我认为它仅适用于 RTDB,但我正在使用 Firestore。

在我的配置文件中,我有以下内容:

firebase/index.js

import firebase from …
Run Code Online (Sandbox Code Playgroud)

firebase reactjs firebase-authentication firebase-realtime-database google-cloud-firestore

1
推荐指数
1
解决办法
1675
查看次数

如何在 IOS Flutter 的 firebase 电话验证中禁用 recaptcha 验证

我正在开发一个 flutter 应用程序,它有这样的注册流程。

- 用户根据设备选择他们的 Google/Apple ID - 然后他们输入电话号码以获取短信 - 然后他们输入短信代码进行验证 - 然后他们输入个人信息并进入应用程序

这是 Android 上的流程,但在 iOS 上,输入电话号码后,应用内浏览器会打开{my_project_name}.firebase-app.com网站。它会出现 2-3 秒,并表示正在验证机器人(没有出现谷歌验证码)。然后它会将我重定向回应用程序。我想禁用它,因为它会导致糟糕的用户体验。(在真实设备中)

我通过生成 APN 的身份验证密钥并将其上传到 firebase 来启用静默通知。

可能有一些东西我错过了,但找不到它是什么。

请帮我解决这个问题,感谢您抽出时间。

ios firebase firebase-authentication flutter flutter-ios

1
推荐指数
1
解决办法
2808
查看次数

无法处理“auth/account-exists-with- different-credential”错误

我已经在 Firebase 控制台中启用了“来自不同提供商的每个电子邮件地址一个帐户”。

但是,当我登录使用密码+电子邮件创建的帐户时,在 Google 身份验证中,'auth/account-exists-with-different-credential'没有捕获错误。有什么我错过的吗?

import React, { useCallback, useEffect } from "react";
import { Link } from "react-router-dom";
import './Auth/ProfileSelect.css';
import './Home.css';
import './Images/SignInIcon.png';
import { withRouter } from "react-router";
import firebaseApp from "./firebase";
import firebase from "firebase/app";
import "firebase/auth";
import {
  FirebaseAuthProvider,
  FirebaseAuthConsumer,
  IfFirebaseAuthed,
  IfFirebaseAuthedAnd
} from "@react-firebase/auth";

const SignUp = ({ history }) => {
  useEffect(() => {
    const disablePinchZoom = (e) => {
      if (e.touches.length > 1) {
        e.preventDefault()
      }
    }
    document.addEventListener("touchmove", disablePinchZoom, …
Run Code Online (Sandbox Code Playgroud)

javascript firebase reactjs firebase-authentication

1
推荐指数
1
解决办法
1766
查看次数

Firebase 9 模块化 - 如何开始

我尝试开始使用 Firebase 9。我使用 VSCode 并使用 npm 导出(在 vscode 中)

   <script src="https://www.gstatic.com/firebasejs/9.0.0-beta.5/firebase-app-compat.js"></script>
   
    <script src="https://www.gstatic.com/firebasejs/9.0.0-beta.5/firebase-analytics-compat.js"></script>
  
    <script src="https://www.gstatic.com/firebasejs/9.0.0-beta.5/firebase-auth-compat.js"></script>
    <script src="https://www.gstatic.com/firebasejs/9.0.0-beta.5/firebase-firestore-compat.js"></script>
    <script src="https://www.gstatic.com/firebasejs/9.0.0-beta.5/firebase-storage-compat.js"></script>
    <!-- init -->
    <script defer src="firebase/init.js" type="text/javascript"></script>

    
    <script type="module">
    import {
        getAuth,
        onAuthStateChanged
    } from "firebase/auth";

    const auth = getAuth(firebaseApp);
    onAuthStateChanged(auth, user => {
        console.log(user)
    });
      </script>
Run Code Online (Sandbox Code Playgroud)

错误

未捕获的类型错误:无法解析模块说明符“firebase/auth”。相对引用必须以“/”、“./”或“../”开头。

javascript firebase-authentication google-cloud-firestore

1
推荐指数
1
解决办法
4436
查看次数

Firebase Auth 电话 OTP 不会在 Android 中自动读取

我正在使用最新的 firebase sdk 进行身份验证,但 otp 自动填充不起作用。OTP 短信已成功接收,当我手动输入时,它工作正常,没有任何问题。但我需要自动获取 OTP,无需用户参与。

我的代码:

    mAuth = FirebaseAuth.getInstance();
    editText = findViewById(R.id.sixdigit);
    mTextViewCountDown = findViewById(R.id.text_view_countdown);

    progress = new ProgressDialog(GVerifyotpActivity.this);
    progress.setMessage("Waiting....");
    progress.setProgressStyle(ProgressDialog.STYLE_SPINNER);

    String phonenumber = getIntent().getStringExtra("phonenumber");
    sendVerificationCode(phonenumber);

    findViewById(R.id.pnext).setOnClickListener(v -> {
        String code = editText.getText().toString().trim();
        if (code.isEmpty() || code.length() < 6) {
            editText.setError("Enter code...");
            editText.requestFocus();
            return;
        }
        verifyCode(code);
    });

    mButtonStartPause = findViewById(R.id.button_start_pause);
    mButtonStartPause.setOnClickListener(view -> {
        resetTimer();
        startTimer();
        resendVerificationCode(phonenumber, mResendToken);
    });
}

private void verifyCode(String code) {
    PhoneAuthCredential credential = PhoneAuthProvider.getCredential(verificationId, code);
    signInWithCredential(credential);
    if(progress!=null && !progress.isShowing()) {
        progress.show();
    }
} …
Run Code Online (Sandbox Code Playgroud)

android firebase firebase-authentication

1
推荐指数
1
解决办法
3007
查看次数

避免用户在创建时使用 Firebase 登录

我有一个应用程序,其中用户应该仅由管理员用户创建,问题是,当在 Firebase 中创建新用户时,应用程序使用新用户信息登录,因此原始登录用户(管理员用户)必须登录退出,然后重新登录以创建新用户。

这是我创建新用户的功能:

void createUser(
    String email,
    String password,
    String nombre,
    String dui,
    DateTime fechaNacimiento,
    String telefono,
    String nombreContacto,
    String telefonoContacto,
    DateTime fechaIngreso,
    String radio,
    File foto,
    String acceso,
  ) async {
    try {
      final auth = FirebaseAuth.instance;

      UserCredential authResult = await auth.createUserWithEmailAndPassword(
        email: email,
        password: password,
      );

      //var uploadUid = authResult.user?.uid;

      final ref = FirebaseStorage.instance
          .ref()
          .child('user_images')
          .child(authResult.user!.uid + '.jpg');

      await ref.putFile(foto);

      final url = await ref.getDownloadURL();

      await FirebaseFirestore.instance
          .collection('users')
          .doc(authResult.user!.uid)
          .set({
        'nombre': nombre,
        'dui': dui,
        'fechaNacimiento': fechaNacimiento, …
Run Code Online (Sandbox Code Playgroud)

firebase firebase-authentication flutter

1
推荐指数
1
解决办法
512
查看次数

firebase.auth() 在打字稿中显示错误

我正在尝试使用 Firebase 和 TypeScript 开发一个具有身份验证的应用程序,但在调用 .auth 函数时发现错误。

悬停时显示的错误是:

类型“typeof import("e:/Projects/spectrum-test/node_modules/firebase/app/dist/app/index")'.ts(2339) 上不存在属性“auth”

这行 ( export const auth = firebase.auth();) 在 JS 中可以正常工作,但由于某种原因 TS 不喜欢它;

firebase.ts

import firebase from 'firebase/app';
import 'firebase/auth';

const firebaseConfig = {
    apiKey: process.env.REACT_APP_FIREBASE_API_KEY,
    authDomain: process.env.REACT_APP_FIREBASE_AUTH_DOMAIN,
    projectId: process.env.REACT_APP_FIREBASE_PROJECT_ID,
    storageBucket: process.env.REACT_APP_FIREBASE_STORAGE_BUCKET,
    messagingSenderId: process.env.REACT_APP_FIREBASE_MESSAGING_SENDER_ID,
    appId: process.env.REACT_APP_FIREBASE_APP_ID
}

firebase.initializeApp(firebaseConfig);
export const auth = firebase.auth();
Run Code Online (Sandbox Code Playgroud)

我已经安装了@firebase/auth-types@0.11.0,但没有解决问题

任何帮助表示赞赏。

typescript firebase-authentication

1
推荐指数
1
解决办法
1700
查看次数

Flutter Google Sign-in,选择帐户后卡住

我在尝试在 Flutter 应用程序中使用 Google Sign-in 登录 Firebase 时遇到问题。

我看过另外两篇关于此问题的帖子,但没有答案可以为我自己解决这个问题。我在 flutter 中使用 Google Sign-in 提供程序,google_sign_in: ^5.1.0,Flutter 版本 2.2.1

我已按照有关生成/添加 Sha-1、Sha-256 密钥到我的 firebase 项目的说明进行操作。在此之前,我遇到了 API 异常。我添加了密钥,将最新的 google-json 文件下载到我的 android 文件夹中,并克服了该错误。现在,当我单击“登录”时,我会看到帐户选择屏幕。

在此输入图像描述

我选择了我的帐户,然后我点击了一个带有无尽旋转的白色页面。

在此输入图像描述

这是我正在运行的登录代码。

GoogleSignIn _googleSignIn = GoogleSignIn(
  scopes: <String>[
    'email',
    'https://www.googleapis.com/auth/contacts.readonly',
  ],
);

  Future<void> _handleGoogleSignIn() async {
    try {
      GoogleSignInAccount? googleSignInAccount =
          await _googleSignIn.signIn();

      GoogleSignInAuthentication? googleSignInAuthentication =
          await googleSignInAccount?.authentication;
    

      final AuthCredential credential = GoogleAuthProvider.credential(
        accessToken: googleSignInAuthentication?.accessToken,
        idToken: googleSignInAuthentication?.idToken,
      );

      final UserCredential user = await _auth.signInWithCredential(credential);  
    } catch (error) {
      print('in error block');
      print(error); …
Run Code Online (Sandbox Code Playgroud)

firebase firebase-authentication google-signin flutter

1
推荐指数
1
解决办法
2124
查看次数