使用 SAML 登录 Firebase 会解决什么问题?
What does signing in to Firebase with SAML resolve with?
我已经将我的 Firebase 应用程序设置为使用 SAML 登录,但是很难找到测试它的方法。
使用 SAML 登录的示例代码是:
firebase.auth().signInWithPopup(provider)
.then((result) => {
// User is signed in.
// Identity provider data available in result.additionalUserInfo.profile,
// or from the user's ID token obtained via result.user.getIdToken()
// as an object in the firebase.sign_in_attributes custom claim
// This is also available via result.user.getIdTokenResult()
// idTokenResult.claims.firebase.sign_in_attributes.
})
.catch((error) => {
// Handle error.
});
结果对象到底是什么样子的?我需要获取用户的名字、姓氏和电子邮件。一些 IDP 也提供角色信息,在对象中的什么位置?
这是在文档中定义的:https://firebase.google.com/docs/reference/js/firebase.auth.Auth.html#signinwithpopup
所以 return 是 UserCredential
。
您可以在此处查看所有可用属性:https://firebase.google.com/docs/reference/js/firebase.auth.html#usercredential
我已经将我的 Firebase 应用程序设置为使用 SAML 登录,但是很难找到测试它的方法。
使用 SAML 登录的示例代码是:
firebase.auth().signInWithPopup(provider)
.then((result) => {
// User is signed in.
// Identity provider data available in result.additionalUserInfo.profile,
// or from the user's ID token obtained via result.user.getIdToken()
// as an object in the firebase.sign_in_attributes custom claim
// This is also available via result.user.getIdTokenResult()
// idTokenResult.claims.firebase.sign_in_attributes.
})
.catch((error) => {
// Handle error.
});
结果对象到底是什么样子的?我需要获取用户的名字、姓氏和电子邮件。一些 IDP 也提供角色信息,在对象中的什么位置?
这是在文档中定义的:https://firebase.google.com/docs/reference/js/firebase.auth.Auth.html#signinwithpopup
所以 return 是 UserCredential
。
您可以在此处查看所有可用属性:https://firebase.google.com/docs/reference/js/firebase.auth.html#usercredential