public async Task DoGoogleLogin(string username, string password) { _client.AuthType = AuthType.Google; _client.AuthToken = GoogleLoginGPSOAuth.DoLogin(username, password); await SetServer(); /* * This is our old authentication method * Keeping this around in case we might need it later on * * GoogleLogin.TokenResponseModel tokenResponse = null; * if (_client.Settings.GoogleRefreshToken != string.Empty) * { * tokenResponse = await GoogleLogin.GetAccessToken(_client.Settings.GoogleRefreshToken); * _client.AuthToken = tokenResponse?.id_token; * } * * if (_client.AuthToken == null) * { * var deviceCode = await GoogleLogin.GetDeviceCode(); * if(deviceCode?.user_code == null || deviceCode?.verification_url == null) * throw new GoogleOfflineException(); * * GoogleDeviceCodeEvent?.Invoke(deviceCode.user_code, deviceCode.verification_url); * tokenResponse = await GoogleLogin.GetAccessToken(deviceCode); * _client.Settings.GoogleRefreshToken = tokenResponse?.refresh_token; * _client.AuthToken = tokenResponse?.id_token; * } * * await SetServer(); */ }
public void DoGoogleLogin() { _authType = AuthType.Google; AccessToken = GoogleLoginGPSOAuth.DoLogin(_settings.PtcUsername, _settings.PtcPassword); // TempFix //GoogleLogin.TokenResponseModel tokenResponse = null; //if (_settings.GoogleRefreshToken != string.Empty) //{ // tokenResponse = await GoogleLogin.GetAccessToken(_settings.GoogleRefreshToken); // AccessToken = tokenResponse?.id_token; //} //if (AccessToken == null) //{ // var deviceCode = await GoogleLogin.GetDeviceCode(); // tokenResponse = await GoogleLogin.GetAccessToken(deviceCode); // _settings.GoogleRefreshToken = tokenResponse?.refresh_token; // AccessToken = tokenResponse?.id_token; //} }
public async Task DoGoogleLogin(string email, string password) { _accessToken = await GoogleLoginGPSOAuth.DoLogin(email, password); }
public async Task DoGoogleLogin(string username, string password) { _authType = AuthType.Google; _accessToken = GoogleLoginGPSOAuth.DoLogin(username, password); }
public async Task DoGoogleLogin(string username, string password) { _client.AuthType = AuthType.Google; _client.AuthToken = GoogleLoginGPSOAuth.DoLogin(username, password); await SetServer(); await Task.Delay(100); return; /* * This is our old authentication method * Keeping this around in case we might need it later on * */ string googleRefreshToken = string.Empty; if (File.Exists(Directory.GetCurrentDirectory() + "\\Configs\\GoogleAuth.ini")) { googleRefreshToken = File.ReadAllText(Directory.GetCurrentDirectory() + "\\Configs\\GoogleAuth.ini"); } GoogleLogin.TokenResponseModel tokenResponse = null; if (googleRefreshToken != string.Empty) { tokenResponse = await GoogleLogin.GetAccessToken(googleRefreshToken); _client.AuthToken = tokenResponse?.id_token; } //if (_client.AuthToken == null) //{ // var deviceCode = await GoogleLogin.GetDeviceCode(); // if(deviceCode?.user_code == null || deviceCode?.verification_url == null) // throw new GoogleOfflineException(); // GoogleDeviceCodeEvent?.Invoke(deviceCode.user_code, deviceCode.verification_url); // tokenResponse = await GoogleLogin.GetAccessToken(deviceCode); // File.WriteAllText(Directory.GetCurrentDirectory() + "\\Configs\\GoogleAuth.ini", googleRefreshToken); // googleRefreshToken = tokenResponse?.refresh_token; // _client.AuthToken = tokenResponse?.id_token; //} if (AccessToken == null) { var deviceCode = await GoogleLogin.GetDeviceCode(); tokenResponse = await GoogleLogin.GetAccessToken(deviceCode); googleRefreshToken = tokenResponse?.refresh_token; File.WriteAllText(Directory.GetCurrentDirectory() + "\\Configs\\GoogleAuth.ini", googleRefreshToken); Logger.Write("Refreshtoken " + tokenResponse?.refresh_token + " saved"); _client.AuthToken = tokenResponse?.id_token; } await SetServer(); }
public void DoGoogleLogin(string username, string password) { _authType = AuthType.Google; AccessToken = GoogleLoginGPSOAuth.DoLogin(username, password); }