I'm using custom JWT in my .NET Core project with jose-jwt. (All other auth methods I tried were confusing as hell.) I have everything implemented, but I'm not sure how I can verify the token on each request. Most of the functions in my API will require this auth, so I'd like to register it globally and specify the functions that don't require it (essentially like [AllowAnonymous]
). I'd like a 401 to be returned if auth fails.
I don't need code completely written for me, but I'm not sure how to write this and insert it into the pipeline. How can I accomplish this? Am I even going about this the right way?