简体   繁体   English

使用ASP.NET登录Facebook

[英]Facebook login with ASP.NET

I am implementing Facebook login on my website. 我正在我的网站上实现Facebook登录。 I am creating an asp.net user as well with the Facebook users details. 我正在创建一个asp.net用户以及Facebook用户详细信息。 This way I can control login in people to my site using .NET membership regardless of whether they are a Facebook user or not. 这样,无论他们是否是Facebook用户,我都可以使用.NET成员身份控制人们到我网站的登录。

The problem I am facing now is security. 我现在面临的问题是安全性。 When a user logs in with Facebook I am calling a webservice with their facebook details, if the user exists on the system (by their facebook userid) then I log them in. However as it stands anyone could call the webservice with someone elses facebook id and it would log them in (if that user existed on the system). 当用户使用Facebook登录时,我正在使用其Facebook详细信息调用Web服务,如果该用户存在于系统上(通过其Facebook用户ID),则我将其登录。但是,按照目前的情况,任何人都可以使用其他人的Facebook ID来调用Web服务。并将其登录(如果该用户存在于系统上)。 Is there something that I can use to link the facebook user with my asp.net user that is only accessible to that user, such as an access token. 有什么我可以用来将facebook用户链接到我的asp.net用户(仅该用户可以访问)的链接,例如访问令牌。 It also needs to be something which does not change? 还需要保持不变吗? Does facebook send back such a thing in the response object? Facebook是否在响应对象中发送回这样的东西?

Any help or suggestions are much appreciated. 任何帮助或建议,不胜感激。

Thanks 谢谢

Yes, we can get that profile data from Facebook. 是的,我们可以从Facebook获取该个人资料数据。 Using that requestAccessToken Url you can get that access token. 使用该requestAccessToken Url,您可以获得该访问令牌。

requestAccessTokenurl="https://graph.facebook.com/oauth/access_token?client_id={0} redirect_uri={1};client_secret={2};code={3}" requestAccessTokenurl =“ https://graph.facebook.com/oauth/access_token?client_id={0} redirect_uri = {1}; client_secret = {2}; code = {3}”

Also we can get the Profile Data using this access token requestProfileUrl="https://graph.facebook.com/me" 我们也可以使用此访问令牌requestProfileUrl =“ https://graph.facebook.com/me”获取配置文件数据

please see this link- http://easyoauth.codeplex.com/ 请参阅此链接-http: //easyoauth.codeplex.com/

you can download the source code also :) 您也可以下载源代码:)

We have implemented for Facebook, Twitter, LinkedIn, Google using this framework. 我们已经使用此框架为Facebook,Twitter,LinkedIn和Google实施了。 It is very straight forward. 这是非常简单的。 I can help you how to do this. 我可以为您提供帮助。

Thanks 谢谢

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM