What are some common design patterns that community is following for refreshing tokens?
r
rp_st
06/15/2022, 11:54 AM
hey @sharma8471 are you implementing your own session refreshing or using supertokens?
s
sharma8471
06/15/2022, 3:14 PM
Using Supertokens
r
rp_st
06/15/2022, 3:27 PM
well, as a user of supertokens, you shouldnt' really have to care that much about how sessions are refreshed. That happens on its own. if you can give me more context around the question, I can perhaps shed more light.
s
sharma8471
06/16/2022, 12:30 AM
I'm using
supertokens-website
sdk which doesn't have the refresh token mechanism. Which is why I wrote my own mechanism for that. Note: I am doing the server side rendering.
It is working but I'm just curious how other people do it. And what would be the best combination of UX+security in this case.
r
rp_st
06/16/2022, 5:03 AM
That SDK does have the refresh token mechanism
rp_st
06/16/2022, 5:04 AM
You need to initialise it and it adds interceptors to fetch. If you are using axios, you need to add the interceptor to axios yourself. The interceptor we provide refreshes the session on its own
rp_st
06/16/2022, 5:04 AM
Did you miss that in the docs? Or rather, what made you think the SDK doesn’t call refresh?
SuperTokens is an open source authentication solution offering features like: Different types of login: Email / password, Passwordless (OTP or Magic link based).