0

输入登录详细信息(真实帐户登录详细信息)后,twitter 正在打开自己的登录页面,而不是重定向到我的应用程序“登录后页面”。我发现'auth.Completed'没有被调用。

我使用相同的代码(如下)使用“OAuth2Authenticator”登录 Facebook,效果很好。发现许多其他开发人员面临这些问题,但没有人提供相关答案。

以下所有 URI 与您注册应用程序以登录 twitter 时获得的一样,但我没有足够的信用来在下面添加链接。

var auth = new OAuth1Authenticator(consumerKey: "MyAppKey", consumerSecret:    "MyAppSecret", requestTokenUrl: new Uri(""), authorizeUrl: new Uri(""), accessTokenUrl: new Uri(""), callbackUrl: new Uri("http://mobile.twitter.com"));

        auth.Completed += (sender, eventArgs) =>
        {
        //  this.DismissViewController(true, null);

            System.Diagnostics.Debug.WriteLine("Is user authenticated" + eventArgs.IsAuthenticated);


            if (eventArgs.IsAuthenticated)
            {
                System.Diagnostics.Debug.WriteLine("method should be invoked.");

                App.Instance.SaveToken(eventArgs.Account.Properties["access_token"]);

                App.Instance.SuccessfulLoginAction.Invoke();


            }
            else 
            {
                System.Diagnostics.Debug.WriteLine("Not Authenticate");

                //this.DismissViewController(true, null);
            }
        };


        PresentViewController(auth.GetUI(), true, null);
4

1 回答 1

1

这听起来像是Xamarin Android Xamarin.Auth - Twitter的副本。

尝试将您的回调 URL 更改为:http://mobile.twitter.com/home。此外,在您的Completed回调中,使用oauth_token而不是access_token属性。access_token仅适用于 OAuth2。

于 2016-10-09T14:34:34.840 回答