Fantasy-Fit / fantasy-fit-web

Creative Commons Zero v1.0 Universal
3 stars 2 forks source link

Fix auth redirect on jwt expiry #147

Closed chris-t-li closed 1 year ago

chris-t-li commented 1 year ago

This PR starts to address Issue #146

Auth Routes on Client

WIP

netlify[bot] commented 1 year ago

Deploy Preview for fantasyfit ready!

Name Link
Latest commit d91e4f75fda270a4d25535284da63d398b5baff6
Latest deploy log https://app.netlify.com/sites/fantasyfit/deploys/64776c4b71cbbb000879446d
Deploy Preview https://deploy-preview-147--fantasyfit.netlify.app/
Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site settings.

chris-t-li commented 1 year ago

Created Issue #149 for handling background task of deleting expired blacklisted tokens

chris-t-li commented 1 year ago

Fixed a semi colon typo that was triggering unauthorized 401.

See line 6 of client/src/store/auth/userSlice.js

chris-t-li commented 1 year ago

Have fixed JWT refresh functionality with latest commit 0452e85

On client side, if baseQuery returns 401 status (because token has expired), client will retry to fetch using refresh token. On rails side, this reaches /auth/refresh endpoint. If refresh token is still valid, generate new tokens and refresh tokens and send back to client.

Still need to test if refresh token is no longer valid.

Also, consider if still need autologin logic as there is duplication here. This addresses issue #146