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.

Refreshing expired tokens

Refreshing expired tokens

- [Instructor] On this part, you'll learn how to generate a new access token using a refresh token. For that, let's go to Visual Studio. In Visual Studio, in the AuthenticationController, we are going to create a new API endpoint. So I'm just going to copy the login-user, then just paste it down here. Replace the login-user with refresh-token, then change the Login with RefreshToken. We're going to also create a new view model. So let us just go to the Solution Explorer. Then inside the ViewModels, right-click, then go to Add. We are going to add a new class. We are going to name this class TokenRequestVM, and I click the Add button. Now, inside here we are going to have two properties. The first property is going to be of type string, and it's going to be the Token, and the second property is going to be the RefreshToken, so RefreshToken. Now, both fields are going to be required. So let us import the namespace for…

Contents