如何在MVC5身份应用程序中使用facebook身份验证检索用户的电子邮件地址? [英] How to retrieve the email address of user using facebook authentication in MVC5 identity application?

查看:86
本文介绍了如何在MVC5身份应用程序中使用facebook身份验证检索用户的电子邮件地址?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在MVC5(身份)中创建了一个新项目。

注册了facebook认证的应用程序。





Startup.Auth.cs



app.UseFacebookAuthentication(

appId:1474706466175318,

appSecret :a616c710d8ee3816929e1d3a7e9ea0ee);



AccountController.cs



[AllowAnonymous]

public async Task< ActionResult> ExternalLoginCallback(string returnUrl)

{

var loginInfo = await AuthenticationManager.GetExternalLoginInfoAsync();

if(loginInfo == null) - > ;当我在这里设置断点时,我正在获取电子邮件ID null

Created a new project in MVC5 (identity).
Registered the app for facebook authentication.


Startup.Auth.cs

app.UseFacebookAuthentication(
appId: "1474706466175318",
appSecret: "a616c710d8ee3816929e1d3a7e9ea0ee");

AccountController.cs

[AllowAnonymous]
public async Task<ActionResult> ExternalLoginCallback(string returnUrl)
{
var loginInfo = await AuthenticationManager.GetExternalLoginInfoAsync();
if (loginInfo == null)-->I am gettting the email id null when i set a breakpoint here

推荐答案

请参阅 - 在默认MVC5应用程序中的帐户关联步骤中从外部提供商Google和Facebook获取电子邮件 [ ^ ]。
See this - Getting the email from external providers Google and Facebook during account association step in a default MVC5 app[^].


这篇关于如何在MVC5身份应用程序中使用facebook身份验证检索用户的电子邮件地址?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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