I develop API POST and it works correctly, but when I add [Authorize] attribute I got 401 Unauthorized in the postman even when I add token correct in header
[Authorize(AuthenticationSchemes = JwtBearerDefaults.AuthenticationScheme)]
[HttpPost]
public async Task<ActionResult> Post([FromBody] CViewModel cVM)
{
// to do
}
I just want to secure my API with JWT TOKEN, API authentication work correctly and generate a token but I can't figure why when I added [Authorize] attribute I got Error 401 Unauthorized in my POST API.
THANKS!
the problem is I used different secret key in the startup and generate token method