❔ Implement JWT to my WebAPI .NET 7.0 project - First time
guys I'd like to implement JWT into my WebAPI project, theory seems to be simple but I'm unable to implement it in my .NET 7.0 project, someone could help me or link me a reliable guide? I'm reading different but each of theme have differences in some points
5 Replies
Hi
Do you have something coded already?
yeah, I added some code to my
Program.cs
Below the code I added for now:
I'm really confused about next steps as every guide show different things to do
now I added this in my appsettings.json
The settings looks okay
Now you need the code to generate the token
Well, now I created a
Post
method for login
in one of my controllers, I don't know if I have to create a custom class for this, or what, maybe yes, I guess something like Auth
controller with this Post
method, I wait confirmation.
For the moment I pasted this code in one of my existing controllers for try it:
I found this code on web, and I adapted it by changing the login system, and creating a fake login for now.
It seems all clear, only I don't understand the GenerateJwtToken
method, if I'm not wrong it's never called.
Forgot to say that's before the GenerateJwpToken
method snippet, is written that I have to implement JWT token logic without further explainations.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.