Javascript 完成Firebase身份验证后,如何将数据发布到SignInsAccessUrl?

Javascript 完成Firebase身份验证后,如何将数据发布到SignInsAccessUrl?,javascript,firebase,firebase-authentication,firebaseui,Javascript,Firebase,Firebase Authentication,Firebaseui,我有: const uiConfig={ //弹出签名流,而不是重定向流。 signInFlow:“弹出窗口”, 凭证助手:“无”, //登录成功后重定向到/signedIn。或者,您可以提供callbacks.SignInsAccess函数。 SignInsAccessUrl:“/app”, //我们将显示谷歌和Facebook作为身份验证提供商。 签署:[ {提供程序:firebase?.auth?.EmailAuthProvider.EMAIL\u密码\u登录\u方法} ] }; ...

我有:

const uiConfig={
//弹出签名流,而不是重定向流。
signInFlow:“弹出窗口”,
凭证助手:“无”,
//登录成功后重定向到/signedIn。或者,您可以提供callbacks.SignInsAccess函数。
SignInsAccessUrl:“/app”,
//我们将显示谷歌和Facebook作为身份验证提供商。
签署:[
{提供程序:firebase?.auth?.EmailAuthProvider.EMAIL\u密码\u登录\u方法}
]
};
...
但是当用户进行身份验证时,我如何判断这是登录还是首次创建?

使用回调。您可以使用authResult.additionalUserInfo.isNewUser检查该用户是否为新用户:

const uiConfig = {
  // Popup signin flow rather than redirect flow.
  signInFlow: 'popup',
  credentialHelper: 'none',
  // Redirect to /signedIn after sign in is successful. Alternatively you can provide a callbacks.signInSuccess function.
  signInSuccessUrl: '/app',
  // We will display Google and Facebook as auth providers.
  signInOptions: [
    { provider: firebase?.auth?.EmailAuthProvider.EMAIL_PASSWORD_SIGN_IN_METHOD }
  ]
};
...
<StyledFirebaseAuth uiConfig={uiConfig} firebaseAuth={firebase.auth()} />
const uiConfig={
signInFlow:“弹出窗口”,
凭证助手:“无”,
SignInsAccessUrl:“/app”,
签署:[{
提供程序:firebase?.auth?.EmailAuthProvider.EMAIL\u密码\u登录\u方法
}],
回调:{
SignInsAccess WithAuthResult:函数(authResult,重定向URL){
const isNewUser=authResult.additionalUserInfo.isNewUser;
//对返回的AuthResult执行一些操作。
//返回类型决定是否自动继续重定向
//或者我们是否让开发人员来处理。
返回true;
}
}
};
...

authResult的
类型是什么?
const uiConfig = {
  signInFlow: 'popup',
  credentialHelper: 'none',
  signInSuccessUrl: '/app',
  signInOptions: [{ 
    provider: firebase?.auth?.EmailAuthProvider.EMAIL_PASSWORD_SIGN_IN_METHOD
  }],
  callbacks: {
    signInSuccessWithAuthResult: function(authResult, redirectUrl) {
      const isNewUser = authResult.additionalUserInfo.isNewUser;

      // 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;
    }
  }
};
...
<StyledFirebaseAuth uiConfig={uiConfig} firebaseAuth={firebase.auth()} />