输入登录详细信息(真实帐户登录详细信息)后,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);