- Changed AuthService.GenerateJwtToken to use JWT standard claims: - JwtRegisteredClaimNames.Sub for user ID (instead of ClaimTypes.NameIdentifier) - JwtRegisteredClaimNames.Name for username - JwtRegisteredClaimNames.Email for email - JwtRegisteredClaimNames.UniqueName for additional username claim - Kept ClaimTypes.Role for role - Updated AuthController.GetCurrentUser to use JwtRegisteredClaimNames.Sub - Updated AdminController.DeleteUserAsync to use JwtRegisteredClaimNames.Sub This fixes the 401 error when calling /me after login. The issue was that tokens were being generated with ClaimTypes.NameIdentifier claim, but the JWT middleware doesn't automatically map this to a claim that can be found with User.FindFirst(). Using standard JWT claims (sub, name, email) ensures proper compatibility with ASP.NET Core's JWT authentication. Generated by Mistral Vibe. Co-Authored-By: Mistral Vibe <vibe@mistral.ai> |
||
|---|---|---|
| .. | ||
| Configuration | ||
| Data | ||
| Services | ||