reactjs - 如何在 Firebase 登录/注册过程中提示用户提供更多信息?
问题描述
我正在使用 firebaseUI 工具集来允许用户登录我的应用程序。一旦他们登录,我还使用 firebase.auth().onAuthStateChanged 方法将它们重定向到主应用程序。
我想做的是,在登录过程中......如果他们是新用户,提示他们使用显示名称(以覆盖第 3 方提供者提供的任何名称)。
现在,一旦他们登录,他们就会被重定向到应用程序..我如何才能拥有一个流畅的工作流程来提供一个模态 /screen 以允许他们在继续使用应用程序之前创建一个显示名称,这并不明显。
是否有关于如何在首次登录过程中捕获/提示其他信息的推荐最佳实践,然后我会将其存储在我的 firebase /users 集合中?
现在它只会自动重定向到主应用程序。
componentDidMount() {
//console.log(this.props.isLoading)
firebase.auth().onAuthStateChanged(user => {
if(user) {
this.props.setUser(user);
this.props.history.push('/');
}
callbacks : {
signInSuccessWithAuthResult: function(authResult, redirectUrl) {
var user = authResult.user;
var credential = authResult.credential;
var isNewUser = authResult.additionalUserInfo.isNewUser;
var providerId = authResult.additionalUserInfo.providerId;
var operationType = authResult.operationType;
if(isNewUser)
{
//prompt user to enter a displayName to use with the application
}
// Do something with the returned AuthResult.
// Return type determines whether we continue the redirect automatically
// or whether we leave that to developer to handle.
return true;
},
},
解决方案
推荐阅读
- c# - 仅从方程中获取系数
- excel - 宏适用于逐步但不使用热键
- java - 我收到 NoSuchWindowException @ 在弹出窗口中单击 OK 按钮(弹出窗口随后关闭)
- internet-explorer - 如何避免 ADF 中的 URL 编码?
- sql - 根据第一个表从连接或添加表中的列创建表
- sql - 需要有关在 Big Query 中运行多个查询的帮助
- node.js - 当 CORS Access-Control-Allow-Origin 设置为 (*) 时设置 cookie
- linux - Grep 在目录中的所有文件中查找字符串,如果找到,将输出文件名附加到 txt?
- android - 安卓 9: android.os.FileUriExposedException:
- python-3.x - 在 pyspark 中,基于变量字段进行分组,并为特定值添加一个计数器(在变量更改时重置)