我在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