private void butAuthGoogle_Click(object sender, EventArgs e) { try { string url = Google.GetGoogleAuthorizationUrl(textUsername.Text); Process.Start(url); InputBox inputbox = new InputBox("Please enter the authorization code from your browser"); inputbox.setTitle("Google Account Authorization"); inputbox.ShowDialog(); if (inputbox.DialogResult != DialogResult.OK) { return; } if (string.IsNullOrWhiteSpace(inputbox.textResult.Text)) { throw new ODException(Lan.g(this, "There was no authorization code entered.")); } string authCode = inputbox.textResult.Text; GoogleToken tokens = Google.MakeAccessTokenRequest(authCode); if (tokens.ErrorMessage != "") { throw new Exception(tokens.ErrorMessage); } textAccessToken.Text = tokens.AccessToken; textRefreshToken.Text = tokens.RefreshToken; groupAuthentication.Location = new Point(_groupAuthLocationXAuthorized, groupAuthentication.Location.Y); groupGoogleAuth.Visible = true; } catch (ODException ae) { MsgBox.Show(ae.Message); } catch (Exception ex) { MsgBox.Show("Error: " + ex.Message); } }