How can I send a refresh token to the server when I receive a 401 error with the message "try refresh token"?
rp_st
04/07/2023, 6:08 PM
This happens automatically via our frontend SDK's session recipe which adds interceptors to fetch / XHR. The interceptor detects when a 401 is sent from the backend and then calls the refresh API on it's own. Therefore, you don't need to do anything to refresh a session, other than make sure that you have initialised the session recipe on the frontend and provided the right apiDomain value.
SuperTokens is an open source authentication solution offering features like: Different types of login: Email / password, Passwordless (OTP or Magic link based).