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

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