自动登录Facebook的 [英] automatic login to facebook

查看:138
本文介绍了自动登录Facebook的的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我要创建在C#中的桌面应用程序。
的事情之一,这个应用程序应该做的是发布的东西给用户的状态在Facebook上(如:戴夫刚刚夺得3枚金牌)。这应该发生用户是否登录,现在到Facebook或没有。我希望用户一次给我所需的所有权限,然后一切都会自动发生(我会拯救任何需要我的DB)。
我尝试使用Facebook开发工具包2.0 .NET却没有看到有任何东西能够帮助我。
任何帮助,将不胜感激。

I'm creating a desktop application in C#. one of the things that this application should do is to publish things to the status of the user in facebook (like: "dave just won 3 gold medals" ). this should happen whether the user is logged in now to facebook or not. I want the user to give me all the needed permissions once and then everything would happen automatically (I would save whatever is needed on my DB). I tried using facebook developer toolkit 2.0 for .net but didn't see anything there that could help me. ANY help would be appreciated.

推荐答案

Iv'e得到了一些答案在这里。我认为它回答我在网上看到了最近其​​他问题:

Iv'e got some answers here. I think it answers other questions I saw in the web lately:

我的回答是有关的作品的Facebook之外的桌面应用程序(谢谢连接)。
+我使用Facebook的开发工具包2.1:

My answer is related to desktop applications that works outside of facebook (facebook connect). + I'm using the facebook developer toolkit 2.1:

下面是如何获得特别许可,需要脱机访问。以及如何获得会话密钥:

Here is how to get the special permission, needed to for offline access. and how to get the session key:

facebook.Components.FacebookService FS = new facebook.Components.FacebookService();
FS.GetExtendedPermission(facebook.Types.Enums.Extended_Permissions.offline_access);



第二行会迫使你登录,之后会要求权限之后,用户选择授予许可,您将得到在后URL - 在fb_si_session_key。但工具箱开发商没有做足够它给您带来: - (

The second line will force you to login and afterwards would ask for the permission after the user choose to grant the permission, you are given in the post URL - the fb_si_session_key. BUT the toolkit developers didn't do enough to bring it to you :-(

所以,你有几个选择简单的一个是做:

So you have few options. the simple one is to do:

FS.Logoff();
FS.ConnectToFacebook();

会发生什么事是,你会看到登录屏幕一秒钟,你会之前可以点击任何东西,它就会​​消失。但这个时候你就会有正确的。会话密钥就可以得到它这样的:

What will happen is that you'll see the login screen for a second and before youll be able to click anything it would vanish. but this time you'll have the right session key. you can get it like that:

string myPermanentSessionKey =  FS.API.SessionKey;

如果你不想显示恼人的画面再次你有几个选择,所有这些都涉及到改变工具包的源文件。我不会进入这里,只是告诉你一个简单的选择:在facebookconnect()函数,我改变了它接受一个参数(isShow)当我发送真正给它,它的行为正常,当我发送虚假。它 - 它跳过对 formLogin.ShowDialog();

If you dont want to show that annoying screen again you have few options, all of them are related to changing the source files of the toolkit. I'm not gonna get into it here, but just tell you a simple option: in the facebookconnect() function I changed it to receive a parameter (isShow) when I send true to it, it behaves normal, when I send false to it - it skips on the formLogin.ShowDialog();

它的工作。

这篇关于自动登录Facebook的的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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