❔ Invalid JWT token postman when validating
hi everyone, i am a beginner here. I am having a problem about validate JWT token that already took me a week to resolve it. but didn't find the solution.
18 Replies
so before validate a token, i have a register endpoint in postman. like this
after i register, i can login to the system. when i use login endpoint, it will return me a accound details and jwt token which will be used later for crud operation (there is authorization system for admin and user).
since i already successfully logged in as an admin, i will get a jwt token.
however, the problem is, as an admin, i can not do crud operations (such as: get all accounts).
I checked the token in jwt.io and the token returns the user id.
but why the program can not validate the token?????
here is my validatetoken method
here is my generateJWTtoken method
please help me, i am so desperate..
What does the full error message say? And have you debugged your validate method?
i finally can resolve this issue..... the problem "bearer error = "invalid_token" , error_description="The signature key was not found" has been changed into "Unauthorized" which resides in the AuthorizeAttribute.cs
the error has been changed into this
im sorry, but im kinda confused to debug the validate method since it just returns "error in here meaning it's either not logged in or unauthorized" but this token was from admin role..
here is my repo if you dont mind https://github.com/sunnyjovita/CMSWebAPI/tree/master/CMSWebAPI
GitHub
CMSWebAPI/CMSWebAPI at master · sunnyjovita/CMSWebAPI
Contribute to sunnyjovita/CMSWebAPI development by creating an account on GitHub.
i can also share screen if you dont mind to help me..
How are you getting and setting roles? Is account in the authorization method null?
Was this issue resolved? If so, run
/close
- otherwise I will mark this as stale and this post will be archived until there is new activity.