Reputation: 1
I am working on a personal project which is about creating a simple web app to track projects and manage their hours, their tasks, their users, assignees and so on. I am attaching an image of how my project looks like (inside "client" folder is where the front end is located, written in React).
But for some reason when I try to get the "role" which will be 0 = ProjectManager
, Postman returns a 401 Unauthorized, the messages in the console are :
ā
User Set in Context: [email protected], Role: ProjectManager
š Checking Authorization Header...
š Extracting Claims from Token...
š Claim Type: sub, Value: [email protected]
š Claim Type: email, Value: [email protected]
š Claim Type: http://schemas.microsoft.com/ws/2008/06/identity/claims/role, Value: 0
š Claim Type: exp, Value: 1740528428
š Claim Type: aud, Value: http://localhost:5153
info: Microsoft.EntityFrameworkCore.Database.Command[20101]
Executed DbCommand (0ms) [Parameters=[@__userEmail_0='?' (Size = 4000)], CommandType='Text', CommandTimeout='30']
SELECT TOP(1) [u].[Id], [u].[Email], [u].[IsDeleted], [u].[Name], [u].[PasswordHash], [u].[Role]
FROM [Users] AS [u]
WHERE ([u].[IsDeleted] = CAST(0 AS bit) OR [u].[Id] = 0) AND [u].[Email] = @__userEmail_0
ā
User Set in Context: [email protected], Role: ProjectManager
Logs are made by me; since it's been 2 and a half years since I used Stackoverflow, would you like me to attach/send the controllers file, and models, and which other file code you need in order to help me out? Thanks
I tried different model variables, I tried using [Authorization]
in the controllers, I tried different JWT tokens, one generated inside the app in the API / login endpoint, nothing happens.
Upvotes: 0
Views: 62