MVC 4的OAuth随着Facebook并没有返回的电子邮件地址 [英] MVC 4 oAuth With Facebook does not return email address

查看:192
本文介绍了MVC 4的OAuth随着Facebook并没有返回的电子邮件地址的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我尝试witht他MVC 4的OAuth这是本月发布。
任何人都可以点我在那里我可以添加电子邮件地址,以便我可以存储与用户属性?

I am experimenting witht he MVC 4 oAuth that was released this month. Can anyone point me to where I can add eMail address so that I can store that with user properties?

我需要能够发送欢迎电子邮件,但不知道在哪里的开箱即用的MVC 4 OAuth的。开始

I need to be able to send a welcome email but don't know where to start with the out of the box MVC 4 oAuth.

在理想情况下,成功登录后,我希望收到来自Facebook的用户信息在我的控制器,并在表中删除它,以便脱机进程可以发送欢迎电子邮件。

Ideally, after successful login, I want to receive the User Info from Facebook in my controller and drop it in a table so an offline process can send the welcome email.

谢谢,
维克多

Thanks, Victor

推荐答案

这是因为Facebook允许其用户指定哪些数据与第三方认证服务,比如你的网站维克托共享。并且默认情况下,我相信电子邮件地址(是的,有多个可以添加到一个Facebook帐户)不比亚迪共享默认。用户必须去和明确与第三方分享他们的电子邮件地址 - 这一点我不认为有谁使用

It is because Facebook allows its users to specify what data is shared with 3rd party authentication services, such as you website Victor. And by default, I believe the Email addresses (yes, there are multiple you can add to a facebook account) are not shared byd default. A user has to go in and explicitly share their email addresses with 3rd parties - something I don't think anyone ever uses.

唯一的强制性的共享,Facebook的部队共享数据是全名(例如,埃里克邓肯)。其他的都是可选的用户分享。

The only "mandatory" shared data that Facebook forces shared is the FullName (e.g. "Eric Duncan"). Everything else is optional for the user to share.

例如,我有我的Facebook的设置只共享我的生日,但不是birthyear。我也有我的Facebook设置分享我的利益,而不是我的电子邮件。

For example, I have my Facebook setup to share only my birthdate, but not the birthyear. I also have my Facebook setup to share my interests but not my email.

因此​​,您必须code什么是有保障 - 在Facebook的情况下,显示名称(这是所谓的MVC 4.0的OAuth的用户名)。其他一切都不能保证。

Therefore, you have to code for what is guaranteed - the display name in Facebook's case (which is called the "UserName" in the MVC 4.0 OAuth). Everything else is not guaranteed.

我做我的OAuth应用程序,包括Facebook连接,与第三方身份验证成功后,回调URL页面上(如ExternalLoginConfirmation.cshtml在MVC 4.0),我会要求用户输入他们的显示名称,电子邮件地址,出生日期等,同时使用上的自定义视图模型标准数据注解所需的那些领域。

What I do in my OAuth applications, including Facebook connect, is after a successful authentication with the 3rd party, on the callback url page (e.g. ExternalLoginConfirmation.cshtml in MVC 4.0), I will ask the user to enter their Display Name, email address, birthdate, etc. And make those fields required using standard data annotations on your custom view model.

这篇关于MVC 4的OAuth随着Facebook并没有返回的电子邮件地址的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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