We've covered enough theory for now, so let's crack on and see how refresh tokens actually work. We can't do anything on the frontend of the app until the backend supports refresh tokens, so that's where we're going to start.
Adding refresh token support to the backend
Extending the AppUser model
First up, we need a place to store the refresh token as and when we generate it. As previously discussed, this token is unique to each user, so it belongs in our Data/Entities/AppUser entity model:
namespace ECommerce.Data.Entities
{
public class AppUser : IdentityUser<int>
{
public string FirstName { get; set; }
public string LastName { get; set; }
public string RefreshToken { get; set; ...