登录注销后使用Facebook的问题 [英] Login using Facebook Problem after logging out
问题描述
我使用Facebook的SDK和Facebook连接集成到FB使用asp.net和c#我的网站。用户可以登录使用code成功。我所面临的问题是,只要用户在直通fb的记录;如果用户从Facebook的网站注销,然后尝试使用FB连接通过我的网站登录,提示错误:会话无效,因为用户注销
我要再次提供Facebook的连接按钮登录因为它最初但它给错误。使用的code如下:
保护无效的Page_Load(对象发件人,EventArgs的发送)
{
如果(!Page.IsPostBack)
{
如果(ConnectAuthentication.isConnected())
{
Facebook.Session.ConnectSession _connectSession =新Facebook.Session.ConnectSession(ConfigurationManager.AppSettings [ApiKey],ConfigurationManager.AppSettings [AppSecret]);
如果(!_connectSession.IsConnected())
{
lblStatus.Text =请登录与Facebook。
}
其他
{
Facebook.Rest.Api API =新Facebook.Rest.Api(_connectSession); Facebook.Schema.user用户= api.Users.GetInfo();
字符串全名= user.first_name ++ user.last_name;
lblStatus.Text =全名;
}
}
其他
{
lblStatus.Text =请登录与Facebook。
}
}
}
当用户注销会话无效。你需要让用户再次登录。如果你不想这样做,那么请验证过程中要求offline_access扩展权限。这种方式,用户不必是已登录
仅供参考,你将不得不转移到OAuth 9月1日2011年的Facebook之前只支持后OAuth的。
I am using facebook sdk and facebook connect for integrating fb into my site using asp.net and c#. The user can login using the code successfully. The problem that I face is that whenever a user is logged in thru fb; if the user logs out from the facebook's site and then tries to login through my site using fb connect, it gives error: The session is invalid because the user logged out.
I should again provide the facebook connect button to log in as it does initially but it gives error. The code used is shown below:
protected void Page_Load(object sender, EventArgs e)
{
if (!Page.IsPostBack)
{
if (ConnectAuthentication.isConnected())
{
Facebook.Session.ConnectSession _connectSession = new Facebook.Session.ConnectSession(ConfigurationManager.AppSettings["ApiKey"], ConfigurationManager.AppSettings["AppSecret"]);
if (!_connectSession.IsConnected())
{
lblStatus.Text = "Please sign-in with Facebook.";
}
else
{
Facebook.Rest.Api api = new Facebook.Rest.Api(_connectSession);
Facebook.Schema.user user = api.Users.GetInfo();
string fullName = user.first_name + " " + user.last_name;
lblStatus.Text = fullName;
}
}
else
{
lblStatus.Text = "Please sign-in with Facebook.";
}
}
}
When a user logs out the session is invalidated. You need to have the user log in again. If you don't want to do that then please request the "offline_access" extended permission during authentication. This way the user does not have to be logged-in.
FYI, you will have to move to OAuth before September 1st 2011. Facebook will ONLY support OAuth after that.
这篇关于登录注销后使用Facebook的问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!