From the course: Building and Securing RESTful APIs in ASP.NET Core
Unlock the full course today
Join today to access over 22,700 courses taught by industry experts or purchase this course individually.
Add a token endpoint - ASP.NET Core Tutorial
From the course: Building and Securing RESTful APIs in ASP.NET Core
Add a token endpoint
- [Instructor] Now that we've added ASP.NET Core identity and OpenIdict to the project, we have all the pieces we need to build a token route. The token route will let the client exchange the user's credentials for an access token. I've added a controller called token controller to the project using some code from the OpenIdict samples. You can find it in the exercise files for this video. The token controller has one post route called TokenExchange. This method does a few things, so let's go through the steps one by one to understand everything that it's doing. First, this method checks to make sure that the incoming request is in fact an OpenIdConnect password grant request. If it's not, it'll return an error to the user. Next it looks up the user's user name to make sure the user actually exists in the database, and if not, return an error. Then it checks to make sure that the user is allowed to sign in, and if not, returns an error. It similarly checks to make sure the user is not…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.
Contents
-
-
-
-
-
-
-
-
-
-
-
-
-
-
(Locked)
How HTTP authentication works3m 39s
-
(Locked)
Authentication for REST APIs3m 21s
-
(Locked)
Add Identity4m 51s
-
(Locked)
Add a test user3m 21s
-
(Locked)
Create a users collection5m 45s
-
(Locked)
Create a registration route6m 9s
-
(Locked)
Add OpenIddict4m 12s
-
(Locked)
Add a token endpoint2m 6s
-
(Locked)
Create a UserInfo route5m 28s
-
(Locked)
More about OpenID Connect2m 59s
-
(Locked)
Authorization using policies5m 19s
-
(Locked)
-