Single Sign-On, JWT Authentication, and React
In this series of posts, we create a secured end-to-end JWT-based authentication mechanism using NodeJS, Express, PassportJS, and React.
In this series I cover:
Part 1: Background and Backend using NodeJS
Part 2: React & JWT Authentication
Part 3:...
blog.galmalachi.com10 min read
Gal Malachi First thanks a lot for this in-depth article, I found it while investigating ways and best practices for implementing JWT along with SSO (on the frontend side) so this was exactly what I needed. One small question if I may (I know it's been a while since this was published :) - in my case we don't use Axios interceptors, but rather we wrote our own wrapper function that handles all API calls, and called it 'apiClient' (which uses good old 'fetch' eventually). in that case - how would you recommend going on with updating our wrapper with the first access token that we receive as soon as the app initializes? does exposing a function like 'setAccessToken' from our wrapper and assigning it with the received token would be a consideration? i.e. let's say I use your hook useToken but instead of calling Axios interecpt, I do apiClient.setAccessToken(receivedToken) would love to hear your thoughts on this, and again sorry for raising this question a long time after this article went out - and again thanks so much for this helpful piece of knowledge