private CreateProviderBasedProfileResponse HandleAuthMeResponse(AuthMeResponse authMeResponse) { return(new CreateProviderBasedProfileResponse { NamedId = authMeResponse.UserId, ProviderName = authMeResponse.ProviderName }); }
private CreateProviderBasedProfileResponse HandleTwitterAuthMeResponse(AuthMeResponse authMeResponse) { var avatarUrl = GetClaim(authMeResponse, "urn:twitter:profile_image_url_https"); if (!string.IsNullOrEmpty(avatarUrl)) { avatarUrl = avatarUrl.Replace("_normal.", "_400x400."); } return(new CreateProviderBasedProfileResponse { ProviderId = GetClaim(authMeResponse, ClaimTypes.NameIdentifier), DisplayName = GetClaim(authMeResponse, ClaimTypes.Name), NamedId = authMeResponse.UserId, ProviderName = authMeResponse.ProviderName, AvatarUrl = avatarUrl }); }
private string GetClaim(AuthMeResponse authMeResponse, string claimType) { return(authMeResponse.UserClaims?.SingleOrDefault(claim => claim.Type == claimType)?.Value); }