1

在我的应用程序中,我通过 facebook 授权,一切正常。但是现在我尝试通过FB登录并得到错误:发生错误。请稍后再试。我更新了我的 Facebook,但它没有帮助

这是我的代码

 private const string ExtendedPermissions = "user_about_me";
        private FacebookClient _fb = new FacebookClient();

 public MainPage()
        {
            InitializeComponent();           
            var parameters = new Dictionary<string, object>();
            parameters["client_id"] = FacebookSettings.AppID;
            parameters["redirect_uri"] = "https://www.facebook.com/connect/login_success.html";
            parameters["response_type"] = "token";
            parameters["display"] = "page";
            parameters["scope"] = ExtendedPermissions;
            Uri ur = _fb.GetLoginUrl(parameters);
            webBrowser1.Navigate(ur);

        }

 private void Browser_Navigated(object sender, System.Windows.Navigation.NavigationEventArgs l)
        {
            if (!_fb.TryParseOAuthCallbackUrl(e.Uri, out oauthResult))
            {
                return;
            }

            if (oauthResult.IsSuccess)
            {
                var accessToken = oauthResult.AccessToken;
                LoginSucceded(accessToken);
            }
            else
            {
                MessageBox.Show(oauthResult.ErrorDescription);

            } 

}
4

0 回答 0