billychen0894 / florist-ecommerce-app

Florist eCommerce App built with Next.js 14
https://florist-ecommerce-app.vercel.app
0 stars 0 forks source link

Feat/auth: error handling to refresh access token when verifying access token is expired #36

Closed billychen0894 closed 1 year ago

billychen0894 commented 1 year ago

When the app is verifying access token, it will throw errors right away when it is expired. To prevent this issue, the refresh access token mechanism is implemented. It validates if access token is expired, then refresh it and validate again. If it fails again, then throw errors that are not the TokenExpiredError.