//Get user profile date in terms of claims when calling /connect/userinfo public async Task GetProfileDataAsync(ProfileDataRequestContext context) { try { var email = context.Subject.Claims.FirstOrDefault(x => x.Type == "sub"); if (email == null) { _logger.LogError("No claim of type 'sub'"); } else if (email.Value == null) { _logger.LogError("email in 'sub' claim is empty"); } else { var user = await UserServices.FindAsync(email.Value); if (user != null) { var claims = IdentityHelpers.GetUserClaims(user); context.IssuedClaims = claims.Where(x => context.RequestedClaimTypes.Contains(x.Type)).ToList(); } } } catch (Exception ex) { _logger.LogError("error happend while setting issued claims + \n" + ex.Message); } }