【发布时间】:2018-04-10 17:46:43
【问题描述】:
我正在开发 React js 应用程序,用户可以使用谷歌帐户登录,我想通过使用 firebase 登录来检索用户的注册电话号码。
我已按照本教程制作登录流程
https://github.com/firebase/firebaseui-web-react
我的问题是:当他/她时我可以得到用户的电话号码吗? 使用谷歌电子邮件登录我的系统?
这是我用来登录的部分代码
firebase_ui_instance.start('#firebaseui-auth-container', {
signInFlow:'popup',
signInOptions: [ {
provider: firebase.auth.GoogleAuthProvider.PROVIDER_ID,
// Required to enable this provider in one-tap sign-up.
authMethod: 'https://accounts.google.com',
scopes: [
'https://www.googleapis.com/auth/plus.login',
'https://www.googleapis.com/auth/userinfo.profile',
'https://www.googleapis.com/auth/user.phonenumbers.read'
],
customParameters: {
// Forces account selection even when one account
// is available.
prompt: 'select_account'
},
// Required to enable ID token credentials for this provider.
// This can be obtained from the Credentials page of the Google APIs
// console.
clientId: '[MY_CLIENT_ID]',
credentialHelper: firebaseui.auth.CredentialHelper.GOOGLE_YOL
}
我能够获得有关用户的许多信息(电子邮件、全名...),但不能获得手机号码...
【问题讨论】:
标签: reactjs firebase google-api google-oauth