Skip to main content

Posts

Showing posts from December, 2023

Part-4 |Blazor WebAssembly[.NET 7] JWT Authentication Series | Implement Refresh Token & User Logout

The main objectives  of this article are: Implement Refresh Token User Logout Refresh Token: When the JWT access token expires to renew it without user credentials we will use the Refresh Token. The user sends a valid 'User Name' and 'Password' to the server, then the server will generate JWT Access Token and Refresh Token sent as a response. The JWT Access Token is a short-lived token(eg: 20 minutes) and Refresh Token is a long live token(eg: 7 days). Now client application sends a JWT access token in the request header that makes the user authenticated. If the JWT token expires then the server returns a 401 authorized response. Then the client sends the refresh token to the server to regenerate the JWT Access Token. The server validates the refresh token and returns a new JWT Access Token and a new Refresh Token as a response. SQL Script To Create UserRefreshToken Table: Let's run the below sql script to create 'UserRefreshToken' table that contains colum