/// <summary> /// Private task to get user information from mobile api /// </summary> /// <returns>boolean true if current authorization is valid when online or if offline and user info is cached</returns> public async Task <bool> GetUserInfo() { bool success = false; if (CrossConnectivity.Current.IsConnected) { try { switch (Provider) { case Provider.Custom: var customresult = await CurrentClient.InvokeApiAsync("Account/UserInfo", HttpMethod.Get, null); UserEmail = customresult.SelectToken("Email").Value <string>(); Name = string.Empty; success = true; break; case Provider.Google: case Provider.Facebook: var extResult = await CurrentClient.InvokeApiAsync("/.auth/me", HttpMethod.Get, null); UserEmail = extResult[0].SelectToken("user_id").Value <string>(); var claims = extResult[0].SelectToken("user_claims"); foreach (var claim in claims) { string typ = claim.SelectToken("typ").Value <string>(); if (typ == "name" || typ == @"http://schemas.xmlsoap.org/ws/2005/05/identity/claims/name") { Name = claim.SelectToken("val").Value <string>(); break; } } //foreach( var claim in claims) //{ // if(claim.s) // } success = true; break; default: break; } } catch (Exception ex) { SignOut(); } } else if (!string.IsNullOrEmpty(Token)) { success = true; } return(success); }