我在Xamarin Android中执行twitter登录时遇到问题。 我已经包含了Xamarin.Auth组件,它对Facebook很好。 Fot twitter auth.Completed event is not called ... 我在twitter dev门户上创建了示例应用程序。Xamarin Android Xamarin.Auth - Twitter
下面是从应用我的代码:
private void LoginTwitter()
{
var auth = new OAuth1Authenticator(
consumerKey: "3v7rOXkdexGYhQmr3HVhtGgPO",
consumerSecret: "mGhRjee87tAp4X0vHUmMIohWoYy0JGg9zFGyin7CigFP64y3j5",
requestTokenUrl: new Uri("https://api.twitter.com/oauth/request_token"),
authorizeUrl: new Uri("https://api.twitter.com/oauth/authorize"),
accessTokenUrl: new Uri("https://api.twitter.com/oauth/access_token"),
callbackUrl: new Uri("http://twitter.com")
);
auth.AllowCancel = true;
StartActivity(auth.GetUI(this));
auth.Completed += (s, eventArgs) =>
{
if (eventArgs.IsAuthenticated)
{
Account loggedInAccount = eventArgs.Account;
//save the account data for a later session, according to Twitter docs, this doesn't expire
AccountStore.Create(this).Save(loggedInAccount, "Twitter");
}
};
}
我希望有人可以帮助。
非常感谢!! :) –
只是一个快速更新到这一点,他们现在重定向到这个地址:https://mobile.twitter.com/home,所以你现在需要使用这个作为回调。 – Richard