public void fbstartlogin()
        {
            var loginUrl = "http://www.facebook.com/dialog/oauth?client_id=628708203830784&redirect_uri=http%3A%2F%2Fwww.iitkgp.ac.in%2F&scope=publish_stream%2Cuser_status%2Cuser_photos%2Cphoto_upload%2cread_friendlists&response_type=token&display=touch";

            AuthenticationBrowser.Navigate(new Uri(loginUrl));
            AuthenticationBrowser.Visibility = Visibility.Visible;
        }
示例#2
0
        protected override IAsyncResult BeginExecute(AsyncCodeActivityContext context, AsyncCallback callback, object state)
        {
            authUrl     = AuthenticationUrl.Get(context);
            authMethod  = AuthenticationMethod.Get(context);
            authBrowser = AuthenticationBrowser.Get(context);
            email       = Email.Get(context);
            if (authMethod != "Manual" && email == null)
            {
                throw new ArgumentException("Email must be supplied with Automatic Authorization");
            }
            passwordInsecure = PasswordInsecure.Get(context);
            if (authMethod == "Insecure" && passwordInsecure == null)
            {
                throw new ArgumentException("Insecure Password must be supplied with Insecure Authentication");
            }
            passwordSecure = PasswordSecure.Get(context);
            if (authMethod == "Secure" && passwordSecure == null)
            {
                throw new ArgumentException("Secure Password must be supplied with Secure Authentication");
            }

            browserLoadTimeout = BrowserLoadTimeout.Get(context);
            if (browserLoadTimeout == 0)
            {
                browserLoadTimeout = BrowserLoadTimeoutDefault;
            }

            BuildDefaultAuthUrl(context);
            BuildUrlAndFilename();
            BuildAuthArguments();

            LoadFileDelegate = new Action(LoadFile);
            return(LoadFileDelegate.BeginInvoke(callback, state));
        }
示例#3
0
        private async void AuthenticationBrowser_Navigated(object sender, WebBrowserNavigatedEventArgs e)
        {
            // Get the currently displayed URL and show it in the textbox
            CurrentUrlTextBox.Text = e.Url.ToString();

            // Check if the current URL contains the authorization token
            AuthorizationCodeTextBox.Text = OneDriveApi.GetAuthorizationTokenFromUrl(e.Url.ToString());

            // Verify if an authorization token was successfully extracted
            if (!string.IsNullOrEmpty(AuthorizationCodeTextBox.Text))
            {
                // Get an access token based on the authorization token that we now have
                await OneDriveApi.GetAccessToken();

                if (OneDriveApi.AccessToken != null)
                {
                    // Show the access token information in the textboxes
                    AccessTokenTextBox.Text      = OneDriveApi.AccessToken.AccessToken;
                    RefreshTokenTextBox.Text     = OneDriveApi.AccessToken.RefreshToken;
                    AccessTokenValidTextBox.Text = OneDriveApi.AccessTokenValidUntil.HasValue ? OneDriveApi.AccessTokenValidUntil.Value.ToString("dd-MM-yyyy HH:mm:ss") : "Not valid";

                    // Store the refresh token in the AppSettings so next time you don't have to log in anymore
                    _configuration.AppSettings.Settings["OneDriveApiRefreshToken"].Value = RefreshTokenTextBox.Text;
                    _configuration.Save(ConfigurationSaveMode.Modified);
                    return;
                }
            }

            // If we're on this page, but we didn't get an authorization token, it means that we just signed out, proceed with signing in again
            if (CurrentUrlTextBox.Text.StartsWith(OneDriveApi.SignoutUri))
            {
                var authenticateUri = OneDriveApi.GetAuthenticationUri();
                AuthenticationBrowser.Navigate(authenticateUri);
            }
        }
示例#4
0
        private void MainForm_Load(object sender, EventArgs e)
        {
            var MyIni = new IniFile("Settings.ini");

            MyIni.Write("CNPJ", "88888888888888", "USUARIO");
            MyIni.Write("NOME", "Teste", "USUARIO");

            MyIni.Write("PASTABKP", "C:/temp", "CONFIG");
            MyIni.Write("NOMEARQUIVOBKP", "BKP", "CONFIG");

            MyIni.Write("CLIID", "233d9409-2bc0-404a-8f1e-c122a81615dc", "CONFIG");
            MyIni.Write("SECRET", "3tqjw~T_eb5VDft82NC9LV6ME~v9.k~cIj", "CONFIG");
            MyIni.Write("URLREDIRECT", "https://apps.zomers.eu", "CONFIG");

            OneDriveTypeCombo.SelectedIndex = OneDriveTypeCombo.Items.Count - 1;
            var teste = GetAuthCode();

            AccessTokenTextBox.Text = teste.Result;

            // Create a new instance of the OneDriveApi framework
            InitiateOneDriveApi();

            // First sign the current user out to make sure he/she needs to authenticate again
            var signoutUri = OneDriveApi.GetSignOutUri();

            AuthenticationBrowser.Navigate(signoutUri);
        }
        private void ldstartlogin()
        {
            state = rand.Next(100000000, 999999999).ToString() + rand.Next(100000000, 999999999).ToString();
            Uri ur = new Uri("https://www.linkedin.com/uas/oauth2/authorization?response_type=code&client_id=75ng9iwdzzhk2v&scope=r_basicprofile%20r_emailaddress%20r_network%20rw_nus%20w_messages&state=" + state + "&redirect_uri=http://www.iitkgp.ac.in/");

            AuthenticationBrowser.Navigate(ur);
            this.AuthenticationBrowser.Visibility = Visibility.Visible;
        }
示例#6
0
        private void Step1Button_Click(object sender, EventArgs e)
        {
            // Create a new instance of the OneDriveApi framework
            OneDriveApi = new OneDriveApi(ClientId, ClientSecret);

            // First sign the current user out to make sure he/she needs to authenticate again
            var signoutUri = OneDriveApi.GetSignOutUri();

            AuthenticationBrowser.Navigate(signoutUri);
        }
示例#7
0
        private void Authentication()
        {
            authenticationBrowser = new AuthenticationBrowser();
            authenticationBrowser.PostAuthorizedPin += (pin) =>
            {
                viewModel.PinAuthCommand.Execute(pin);
            };

            authenticationBrowser.Show();
            viewModel.BeginAuthCommand.Execute(null);
        }
示例#8
0
        /// <summary>
        /// Starts the process to interactively authenticate a user and get an Access and Refresh token
        /// </summary>
        private void Step1Button_Click(object sender, EventArgs e)
        {
            // Reset any possible access tokens we may already have
            AccessTokenTextBox.Text = string.Empty;

            // Create a new instance of the OneDriveApi framework
            InitiateOneDriveApi();

            // First sign the current user out to make sure he/she needs to authenticate again
            var signoutUri = OneDriveApi.GetSignOutUri();

            AuthenticationBrowser.Navigate(signoutUri);
        }
示例#9
0
        private void Form1_Load(object sender, EventArgs e)
        {
            OneDriveTypeCombo.SelectedIndex = OneDriveTypeCombo.Items.Count - 1;
            var teste = GetAuthCode();

            AccessTokenTextBox.Text = teste.Result;
            InitiateOneDriveApi();

            // First sign the current user out to make sure he/she needs to authenticate again
            var signoutUri = OneDriveApi.GetSignOutUri();

            AuthenticationBrowser.Navigate(signoutUri);
        }
示例#10
0
        private async void AuthenticationBrowser_Navigated(object sender, WebBrowserNavigatedEventArgs e)
        {
            // Get the currently displayed URL and show it in the textbox
            CurrentUrlTextBox.Text = e.Url.ToString();
            // WebRequest request = WebRequest.Create("https://login.live.com/oauth20_authorize.srf?pretty=false&client_id=233d9409-2bc0-404a-8f1e-c122a81615dc&scope=wl.basic+wl.signin+wl.skydrive&response_type=code&redirect_uri=https:%2f%2flogin.microsoftonline.com%2fcommon%2foauth2%2fnativeclient");
            // WebResponse response = request.GetResponse();
            // Check if the current URL contains the authorization token
            AuthorizationCodeTextBox.Text = OneDriveApi.GetAuthorizationTokenFromUrl(e.Url.ToString());

            // Verify if an authorization token was successfully extracted
            if (!string.IsNullOrEmpty(AuthorizationCodeTextBox.Text))
            {
                // Get an access token based on the authorization token that we now have
                await OneDriveApi.GetAccessToken();

                if (OneDriveApi.AccessToken != null)
                {
                    // Show the access token information in the textboxes
                    AccessTokenTextBox.Text      = OneDriveApi.AccessToken.AccessToken;
                    RefreshTokenTextBox.Text     = OneDriveApi.AccessToken.RefreshToken;
                    AccessTokenValidTextBox.Text = OneDriveApi.AccessTokenValidUntil.HasValue ? OneDriveApi.AccessTokenValidUntil.Value.ToString("dd-MM-yyyy HH:mm:ss") : "Not valid";

                    // Store the refresh token in the AppSettings so next time you don't have to log in anymore
                    _configuration.AppSettings.Settings["OneDriveApiRefreshToken"].Value = RefreshTokenTextBox.Text;
                    _configuration.Save(ConfigurationSaveMode.Modified);
                    return;
                }
            }

            // If we're on this page, but we didn't get an authorization token, it means that we just signed out, proceed with signing in again
            if (CurrentUrlTextBox.Text.StartsWith(OneDriveApi.SignoutUri))
            {
                var authenticateUri = OneDriveApi.GetAuthenticationUri();
                AuthenticationBrowser.Navigate(authenticateUri);
            }
        }
 public webbrowser()
 {
     InitializeComponent();
     AuthenticationBrowser.ClearCookiesAsync();
     checkinput();
 }
示例#12
0
 private void AuthenticationFormLoad(object sender, EventArgs e)
 {
     AuthenticationBrowser.Navigate(Resources.url);
 }
示例#13
0
 private void StartAuthenticationProcess()
 {
     AuthenticationBrowser.DocumentCompleted += AuthenticationBrowserDocumentCompleted;
     AuthenticationBrowser.Navigate(string.Format(_signInUrl, _clientID, _scope));
 }