Hi I want to expire the access token after every two hours and when frontend tries with refresh tok...
k
Hi I want to expire the access token after every two hours and when frontend tries with refresh token , Will it create a new accesstoken and session for the user . I want to customise this flow if customer tries with refresh token , where can I do that in nest js. Also how to set expiration time locally
to modify the refresh API, you can override it on the backend
k
where can i override the refresh api in supertoken service in nest js
r
see our docs please.
override section
i would encourage you to see our docs properly and then ask 🙂 Otherwise it will be difficult for us to help for free. Hope you understand.
k
I already looked that I could not find how to try on backend using postman with refresh token after removing access token And my main doubt was when frontend tries with refresh token do we call the createSession method of supertoken service and assign new session Id?
r
We don’t call create new session that time. We call refresh session
And it does not create a new session handle
k
But as the refresh token asks for the new access token where in supertoken service we do that ? I want to create new access token with updated fields but same sessionHandle Here is my code attached I want to update ipInfo whenever the token gets refreshed Please help
r
so jiust like createNewSession, there isa nother override called refreshSession.
in that, you can call the orginal impl, and that will return a session object back to you (with the same session handle), and then you can call the mergeIntoAccessTokenPayload on that object to modify the access token's claims
k
I could not find any postman apis for testing these out in your docs If we google it then it shows some old versions of docs which are many years old
r
Supertokens.com/docs/fdi
k
So will this code return the session and generate new access token based on customizations I do with input right ?
r
Yup! The result of the original implementation is the session object
On which you can do your modifications
128 Views