c# - 使用存储的访问 token 自动登录

标签 c# facebook windows-8 facebook-c#-sdk facebook-authentication

在我为 Windows 8 编写的应用程序中,我通过 Facebook 进行身份验证。我想这样做,这样您就不必每次都输入您的凭据。我能够写入文件用户的访问 token ,但我无法检查它是否仍处于事件状态。我需要这样的东西 - if (_fb.TryLoginWithStoredToken (storedToken)) {.... }。

如果它返回 false 则抛出正常的 Facebook 登录窗口,即:

loginUrl var = _fb.GetLoginUrl (new
                 {
                     client_id = _facebookAppId,
                     redirect_uri = redirectUrl,
                     scope = _permissions,
                     display = "popup"
                     response_type = "token"
                 });
                 endUri var = new Uri (redirectUrl);
                 WebAuthenticationResult await WebAuthenticationBroker.AuthenticateAsync WebAuthenticationResult = (
                                                         WebAuthenticationOptions.None,
                                                         loginUrl,
                                                         endUri);
                 if (WebAuthenticationResult.ResponseStatus == WebAuthenticationStatus.Success)
                 {
                     callbackUri var = new Uri (WebAuthenticationResult.ResponseData.ToString ());
                     _fb.ParseOAuthCallbackUrl facebookOAuthResult = var (callbackUri);
                     accessToken var = facebookOAuthResult.AccessToken;

我希望这是可能的,如果不能,也许你有更好的想法如何获得这种效果;)

最佳答案

不幸的是,目前 Facebook 不支持允许这种情况发生所需的单点登录 redirect_uri。因此,这是不可能的。

关于c# - 使用存储的访问 token 自动登录,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14150139/

相关文章:

javascript - 使用 javascript 将视频上传到 facebook,无需 php

php - Facebook PHP SDK - 无法正确注销

windows-8 - 在 WinRT 中选择 XAML 的 ListView 和 GridView

animation - 如何在 Windows 8 Metro Apps 中为导航设置动画?

c# - 如何在 WinForms# 中打印面板?

c# - 如何在 C# 中获取屏幕上文本的边界框?

c# - “标准内核”已过时 : `Use StandardKernelConfiguration and StandardReadonlyKernel`

c# LINQ 返回所有连接的结果

Facebook API - 通过 Graph API 无需访问 token 即可访问信息

c++ - 我需要一个 Windows 8 WinRT 应用程序来与用 C 编写的独立应用程序进行通信