Firebase 3 - 其他验证范围数据 [英] Firebase 3 - Additional Auth Scope Data

查看:108
本文介绍了Firebase 3 - 其他验证范围数据的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在Firebase 3文档中,他们表示可以获取其他范围数据,例如:
$ b


可选:指定额外的OAuth 2.0您希望从身份验证提供程序请求的范围。要添加范围,请调用addScope。例如:
provider.addScope('https://www.googleapis.com/auth/plus.login');


一旦验证,我无法找到数据作为用户对象的一部分。任何想法如何挑选额外的数据?



谢谢

解决方案

以Github为例,只有当用户的电子邮件地址在github上设置为public时,才能够检索用户的电子邮件地址。当电子邮件地址设置为私人时,传递用户:电子邮件作用域不起作用。例如

  provider = new firebase.auth.GithubAuthProvider(); 
provider.addScope('user:email');


In the Firebase 3 documentation, they say you can grab additional scope data such as this one:

Optional: Specify additional OAuth 2.0 scopes that you want to request from the authentication provider. To add a scope, call addScope. For example: provider.addScope('https://www.googleapis.com/auth/plus.login');

Once authenicated, I can't find the data as part of the "user" object. Any idea how to pick that extra data ?

Thank you,

解决方案

I have tested this out and using Github as an example, was able to retrieve the user's email address only if the user's email address was set to public on github. Passing the user:email scope had not effect when the email address was set to private. e.g.

provider = new firebase.auth.GithubAuthProvider();
provider.addScope('user:email');

这篇关于Firebase 3 - 其他验证范围数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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