Explore adding JWT to a Web API project, creating a JWT token, and accessing your secure APIs with it.
- Now that you've seen how they work in theory,…let's add JWT to our Web API project,…and use it to secure all of our API endpoints.…First we'll need to add NuGet package for JWT tokens.…I'll do that by going to the NuGet package manager here,…and I'm going to search for the package,…which is called "Microsoft.Owin.Security.Jwt."…And I'll install that in my project.…
We're using the Owin one because…our Web API project uses Owin for startup.…If you're not using Owin, then you'll need…to use a different NuGet package here.…By adding this package though,…we're also getting some other packages,…such as "System.IdentityModel.Tokens.Jwt",…which is the core of the JWT implementation.…Now that we've added the reference,…let's go to configure JWT at startup.…I'll add a new method here in my startup class,…I'm going to call it "ConfigureJWT",…and I'll have it take an "IAppBuilder" parameter,…called app. And then I'll go make sure I'm calling that…here in my configuration constructor.…
Now we'll add some code inside that method to set up JWT.…
AuthorJonathan "J." Tower
- Convention-based routing
- Binding your code to an HTTP request
- Validating models
- Using attributes to route requests
- Customizing attribute routes
- Data serialization and model binding
- Error handling
- Using exception filters and exception loggers
- API documentation and testing
- Securing your API
Skill Level Beginner
ASP.NET MVC: HTTP Request Life Cyclewith Janan Siam2h 15m Advanced
1. Controllers and Actions
3. Data Serialization and Model Binding
4. Error Handling
5. API Documentation and Testing
Next steps1m 38s
- Mark as unwatched
- Mark all as unwatched
Are you sure you want to mark all the videos in this course as unwatched?
This will not affect your course history, your reports, or your certificates of completion for this course.Cancel
Take notes with your new membership!
Type in the entry box, then click Enter to save your note.
1:30Press on any video thumbnail to jump immediately to the timecode shown.
Notes are saved with you account but can also be exported as plain text, MS Word, PDF, Google Doc, or Evernote.