When I put the [AllowAnonymous] attribute at the controller level and the [Authorize] attribute at the method level then Authorize is not working if I removed AllowAnonymous from the controller then it's working.