From the course: ASP.NET Core: Token-Based Authentication
Unlock the full course today
Join today to access over 24,700 courses taught by industry experts.
Generating and storing refresh tokens - ASP.NET Core Tutorial
From the course: ASP.NET Core: Token-Based Authentication
Generating and storing refresh tokens
- [Instructor] So now that you've created the refresh token stable, it is time to generate a refresh token and also store that token in the SQL database. So, let's go to Visual Studio and see connection. In Visual Studio, you need to go to the authentication controller and then you scroll down to the login user. Inside the login user, we have the generateJWTTokenAsync. Let's scroll down in here as well. So after the token is created and you'll also generate the jwtToken using the right token method, we are going to create and store the refresh token. So for that, in here, I'll just type var refreshToken is equal to new RefreshToken. And then inside here, we are going to define all the properties. The first property is going to be the JwtId is equal to the token.Id. The second property is going to be the IsRevoked and I'm going to set the IsRevoked to false. Then we have the UserId and the UserId is going to be the…
Contents
-
-
-
-
(Locked)
Setting up Entity Framework Core8m 44s
-
(Locked)
Adding default identity tables using EF Core8m 51s
-
Configuring token-based authentication9m 38s
-
(Locked)
Adding the authentication controller4m 56s
-
(Locked)
Registering new users using UserManager9m 8s
-
(Locked)
Logging in users4m 54s
-
Generating an access token10m 17s
-
(Locked)
Adding the RefreshToken table5m 4s
-
(Locked)
Generating and storing refresh tokens4m 6s
-
(Locked)
Injecting TokenValidationParameters2m 57s
-
(Locked)
Refreshing expired tokens12m 6s
-
(Locked)
-
-