Exemplo n.º 1
0
        public void OAuth2Authenticator(string clientId, string clientSecret, string scope, Uri authorizeUrl, Uri redirectUrl, Uri accessTokenUrl, GetUsernameAsyncFunc getUsernameAsync = null)
        {
            Xamarin.Auth.OAuth2Authenticator auth2 = new BaseOAuth2Authenticator(clientId, clientSecret, scope, authorizeUrl, redirectUrl, accessTokenUrl, null); // TODO: getUsernameAsync argument not implemented
            auth2.AllowCancel = AllowCancel;
            auth2.Completed  += (sender, eventArgs) =>
            {
                Completed(auth2, new AuthenticatorCompletedEventArgs(new Account(eventArgs.Account, eventArgs.Account.Properties, eventArgs.Account.Username)));
            };
#if __ANDROID__
            Android.Content.Intent intent = auth2.GetUI(Auth.context);
            Auth.context.StartActivity(intent);
#elif __IOS__
            UIKit.UIViewController vc = auth2.GetUI();
            Auth.dialog.PresentViewController(vc, true, null);
#elif SILVERLIGHT
            Uri uri = auth2.GetUI();
            NavigationService.Navigate(uri);
#endif
        }
Exemplo n.º 2
0
        public void OAuth2Authenticator(string clientId, string scope, Uri authorizeUrl, Uri redirectUrl, string replacementFormatUrl)
        {
            Xamarin.Auth.OAuth2Authenticator auth2 = new BaseOAuth2Authenticator(clientId, scope, authorizeUrl, redirectUrl, replacementFormatUrl);
            auth2.AllowCancel = AllowCancel;
            auth2.Completed  += (sender, eventArgs) =>
            {
                Completed(auth2, new AuthenticatorCompletedEventArgs(new Account(eventArgs.Account, eventArgs.Account.Properties, eventArgs.Account.Username)));
            };
            auth2.Error += (sender, eventArgs) =>
            {
                Error(sender, new AuthenticatorErrorEventArgs(eventArgs.Message, eventArgs.Exception));
            };
#if __ANDROID__
            Android.Content.Intent intent = auth2.GetUI(Auth.context);
            Auth.context.StartActivity(intent);
#elif __IOS__
            UIKit.UIViewController vc = auth2.GetUI();
            Auth.dialog.PresentViewController(vc, true, null);
#elif SILVERLIGHT
            Uri uri = auth2.GetUI();
            NavigationService.Navigate(uri);
#endif
        }
Exemplo n.º 3
0
        public void OAuth2Authenticator(string clientId, string clientSecret, string scope, Uri authorizeUrl, Uri redirectUrl, Uri accessTokenUrl, GetUsernameAsyncFunc getUsernameAsync = null)
        {
            Xamarin.Auth.OAuth2Authenticator auth2 = new BaseOAuth2Authenticator(clientId, clientSecret, scope, authorizeUrl, redirectUrl, accessTokenUrl, null); // TODO: getUsernameAsync argument not implemented
            auth2.AllowCancel = AllowCancel;
            auth2.Completed += (sender, eventArgs) =>
            {
                Completed(auth2, new AuthenticatorCompletedEventArgs(new Account(eventArgs.Account, eventArgs.Account.Properties, eventArgs.Account.Username)));
            };
#if __ANDROID__
            Android.Content.Intent intent = auth2.GetUI(Auth.context);
            Auth.context.StartActivity(intent);
#elif __IOS__
            UIKit.UIViewController vc = auth2.GetUI();
	        Auth.dialog.PresentViewController(vc, true, null);
#elif SILVERLIGHT
            Uri uri = auth2.GetUI();
	        NavigationService.Navigate(uri);
#endif
        }
Exemplo n.º 4
0
        public void OAuth2Authenticator(string clientId, string scope, Uri authorizeUrl, Uri redirectUrl, string replacementFormatUrl)
        {
            Xamarin.Auth.OAuth2Authenticator auth2 = new BaseOAuth2Authenticator(clientId, scope, authorizeUrl, redirectUrl, replacementFormatUrl);
            auth2.AllowCancel = AllowCancel;
            auth2.Completed += (sender, eventArgs) =>
            {
                Completed(auth2, new AuthenticatorCompletedEventArgs(new Account(eventArgs.Account, eventArgs.Account.Properties, eventArgs.Account.Username)));
            };
            auth2.Error += (sender, eventArgs) =>
            {
                Error(sender, new AuthenticatorErrorEventArgs(eventArgs.Message, eventArgs.Exception));
            };
#if __ANDROID__
            Android.Content.Intent intent = auth2.GetUI(Auth.context);
            Auth.context.StartActivity(intent);
#elif __IOS__
            UIKit.UIViewController vc = auth2.GetUI();
	        Auth.dialog.PresentViewController(vc, true, null);
#elif SILVERLIGHT
            Uri uri = auth2.GetUI();
	        NavigationService.Navigate(uri);
#endif
        }