Esempio n. 1
0
        public async void OnAuthenticationCompleted(OAuthToken token)
        {
            var googleService = new GoogleService();
            var profile       = await googleService.GetProfileAsync(token.TokenType, token.AccessToken);

            var googleButton = FindViewById <Button>(Resource.Id.googleLoginButton);

            //googleButton.Text = $"Connesso con {profile.given_name}";
            Preferences.Set("tokenType", token.TokenType);
            Preferences.Set("accessToken", token.AccessToken);
            Preferences.Set("email", profile.email);
            Preferences.Set("nome", profile.given_name);
            Preferences.Set("cognome", profile.family_name);
            var credenziali = new Credenziali(profile.email, token);

            UtenteCredenzialiService.Salva(credenziali, new Utente(profile.given_name, profile.family_name));
        }
Esempio n. 2
0
 /// <summary>
 /// Set profile
 /// </summary>
 /// <param name="token">accessToken</param>
 /// <returns>Return the result</returns>
 public async Task SetProfileAsync(string token)
 {
     Settings.AccessToken = token;
     Model = await GoogleService.GetProfileAsync();
 }