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; 

我希望這是可能的,如果沒有,也許你有更好的想法如何得到這個效果;)

回答

1

不幸的是,在這個時候Facebook不支持所需的單點登錄redirect_uri,這將允許這種情況發生。因此,這是不可能的。