public async void OnAuthenticationCompleted(GoogleOAuthToken token, Account account) { //Retrieve the user's email address var googleService = new GoogleService(); var email = await googleService.GetEmailAsync(token.TokenType, token.AccessToken); //Add email address to account account.Properties.Add("Email", email); //Retrieve IdToken //var idToken = await googleService.GetOpenIdAsync(token.TokenType, token.AccessToken, account); //Display email on the UI //var googleButton = FindViewById<Button>(Resource.Id.googleLoginButton); //googleButton.Text = $"Connected with {email}"; //Save logged in user CredentialsService credentialsService = new CredentialsService(); credentialsService.SaveCredentials(account); var intent = new Intent(this, typeof(MainActivity)); StartActivity(intent); Finish(); }
public void LogOut(object sender, EventArgs args) { CredentialsService credentialsService = new CredentialsService(); credentialsService.DeleteCredentials(); var intent = new Intent(Context, typeof(LogInActivity)); StartActivity(intent); Activity.Finish(); }