禁用帐户选择器FirebaseUI React [英] Disable account chooser FirebaseUI React

查看:50
本文介绍了禁用帐户选择器FirebaseUI React的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在努力寻找一块小菜一碟,但我仍然找不到解决办法.

I'm struggling with something that looks like a piece of cake, but I still can't manage to find a solution.

我正在使用reactjs和 firebaseUI网络反应来实现Firebase身份验证过程.一切都很好,但是当我尝试使用电子邮件/密码登录时,它会带我到 accountchooser 我不想要的行为.

I'm implementing a firebase authentication process, with reactjs and firebaseUI web react. Everything is just fine, except the fact that when I try to login using email/password, it takes me to accountchooser, which is a behavior I don't want.

我搜索了文档,github问题等...但是我发现的只是在uiConfig对象中添加以下行:

I searched the docs, github issues etc... But All I found was adding the line below in the uiConfig object :

credentialHelper: firebaseui.auth.CredentialHelper.NONE

问题在于,react引发错误,抱怨firebaseui未定义,这是很正常的,因为我从未导入过.

The problem is that react throws an error complaining about firebaseui not being defined, and it's pretty normal I guess because I never imported it.

我在浏览时发现了一个提示,要求将uiCallback道具传递给组件,但我无法弄清楚.

I found a hint while browsing, telling to pass a uiCallback prop to the component, but I am not able to figure it out.

到目前为止,这是我的代码:

So far, here is my code :

import React, { Component } from 'react';
import '../App.css';
import StyledFirebaseAuth from 'react-firebaseui/StyledFirebaseAuth';
import * as firebase from 'firebase'

const uiConfig = {
    signInFlow: 'popup',
    signInSuccessUrl: '/signedIn',
    signInOptions: [
        firebase.auth.GoogleAuthProvider.PROVIDER_ID,
        firebase.auth.FacebookAuthProvider.PROVIDER_ID,
        firebase.auth.EmailAuthProvider.PROVIDER_ID,
    ],
};

export default class SignInScreen extends Component {

    render() {
        return (
            <div>
            <h1>My App</h1>
            <p>Please sign-in:</p>
            <StyledFirebaseAuth uiConfig={uiConfig} firebaseAuth={firebase.auth()}/>
            </div>
        );
    }

} 

我什至不知道我是否在尝试正确的事情.任何帮助将不胜感激.

I don't even know if I am trying the right thing. Any help will be appreciated.

推荐答案

嗯,对于那些可能有用的方法,我找到了解决该问题的方法.

Well, for those it may help, I found a solution to that problem.

  1. yarn add firebaseui
  2. import firebaseui from 'firebaseui'
  3. 在uiConfig对象中
  4. 设置credentialHelper: firebaseui.auth.CredentialHelper.NONE.
  1. yarn add firebaseui
  2. import firebaseui from 'firebaseui'
  3. set credentialHelper: firebaseui.auth.CredentialHelper.NONE in the uiConfig object.

我不知道通过firebaseUI web react安装firebaseui是否很好,但这解决了我的问题.

I don't know if installing firebaseui over firebaseUI web react is something good, but it solved my problem.

这篇关于禁用帐户选择器FirebaseUI React的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆