Firebase Auth 模拟器不断建议真实的 Google 帐户

问题描述 投票:0回答:1

TL;博士 Firebase Auth Emulator 不断建议真实的 Google 帐户。 百分之一的尝试会导致模拟器虚拟帐户弹出。

详细

firebase 提供程序设置:

importProvidersFrom(
      provideAuth(() => {
        const auth = getAuth();
        if (environment.useEmulators) {
          connectAuthEmulator(auth, 'http://127.0.0.1:9099');
        }
        return auth;
      }),

点击“登录”:

<button (click)="onLoginButtonClicked()>login</button>
onLoginButtonClicked() {
this.matDialog.open(FirebaseUiComponent)...



触发 FirebaseUI 模式':

import fbc_app from 'firebase/compat/app';
import { AngularFireAuth as Afc_Auth } from '@angular/fire/compat/auth';
import * as fbui from 'firebaseui';


export class FirebaseUiComponent implements OnInit, OnDestroy {
  afc_Auth = inject(Afc_Auth);
  dialogRef = inject(MatDialogRef<FirebaseUiComponent>);

  ui!: fbui.auth.AuthUI;

  uiConfig = {
    callbacks: {
      signInSuccessWithAuthResult: (authResult) => this.dialogRef.close(authResult),
      signInFailure: (error) => this.dialogRef.close(error),
    },
    signInOptions: [fbc_app.auth.GoogleAuthProvider.PROVIDER_ID],
    signInFlow: 'popup',
    // ...
  };

  ngOnInit() {
    this.afc_Auth.app.then(app => {
      this.ui = new fbui.auth.AuthUI(app.auth());
      this.ui.start('#firebaseui-auth-container', this.uiConfig);
      this.ui.disableAutoSignIn();
    });
  }

  ngOnDestroy() { this.ui.delete(); }
}




点击“使用 Google 登录”后,应显示带有“虚拟”帐户或“添加新帐户”按钮的模式:



...相反,我会收到一个弹出窗口,其中包含我的“真实”Google 帐户可供选择:



请问有什么想法吗?

angular firebase-authentication angularfire2 firebaseui firebase-tools
1个回答
0
投票

您正在查看的 Google 帐户列表是由 Google 根据您之前使用当前浏览器登录该网站的帐户生成的。谷歌不知道也不关心哪些是“真实的”或“虚拟的”——它们都只是要显示的帐户。您对该列表的唯一控制权是完全退出您不想看到的帐户。

如果您不希望它们全部列在同一个位置,您可以尝试为不同类型的帐户使用不同的浏览器(或不同的浏览器配置文件)以将它们分开。登录帐户列表不会跟随您从一个浏览器到另一个浏览器。

© www.soinside.com 2019 - 2024. All rights reserved.