public void InitAuthentication() { if (_userSecrets != null) { return; } var oauth = new Xamarin.Auth.OAuth1Authenticator(consumerKey, consumerSecret, new Uri("https://api.twitter.com/oauth/request_token"), new Uri("https://api.twitter.com/oauth/authorize"), new Uri("https://api.twitter.com/oauth/access_token"), new Uri("http://127.0.0.1/")); oauth.Completed += Oauth_Completed_GetAuthorizer; var presenter = new Xamarin.Auth.Presenters.OAuthLoginPresenter(); presenter.Login(oauth); }
public void OAuth1Authenticator(string consumerKey, string consumerSecret, Uri requestTokenUrl, Uri authorizeUrl, Uri accessTokenUrl, Uri callbackUrl, GetUsernameAsyncFunc getUsernameAsync) { Xamarin.Auth.OAuth1Authenticator auth1 = new Xamarin.Auth.OAuth1Authenticator(consumerKey, consumerSecret, requestTokenUrl, authorizeUrl, accessTokenUrl, callbackUrl, null); // TODO: getUsernameAsync argument not implemented auth1.AllowCancel = AllowCancel; auth1.Completed += (sender, eventArgs) => { Completed(auth1, new AuthenticatorCompletedEventArgs(new Account(eventArgs.Account, eventArgs.Account.Properties, eventArgs.Account.Username))); }; auth1.Error += (sender, eventArgs) => { Error(sender, new AuthenticatorErrorEventArgs(eventArgs.Message, eventArgs.Exception)); }; #if __ANDROID__ Android.Content.Intent intent = auth1.GetUI(Auth.context); Auth.context.StartActivity(intent); #elif __IOS__ UIKit.UIViewController vc = auth1.GetUI(); Auth.dialog.PresentViewController(vc, true, null); #elif SILVERLIGHT Uri uri = auth1.GetUI(); NavigationService.Navigate(uri); #endif }