2

在我为 Windows 8 编写的应用程序中,我通过 Facebook 进行身份验证。我想这样做,您不必每次都输入您的凭据。我能够写入文件用户的访问令牌,但我无法检查它是否仍然处于活动状态。我需要这样的东西-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;

我希望这是可能的,如果没有,也许您对如何获得这种效果有更好的了解;)

4

1 回答 1

1

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

于 2013-03-18T01:44:42.610 回答