Where is the documentation for SessionContainerInt...
# support-questions-legacy
c
Where is the documentation for SessionContainerInterface?
r
hey @chunkygoo. there is no docs explaining what each of those functions do.
Well, not yet anyway
but the getExpiry function returns info about when the session's last issued refresh token is going to expire.
c
I see. I’m using trpc, and it seems like the refresh function isn’t getting called automatically.
Is there a way to “refresh token” on the server (API) side? Not in getServerSideProps
FYI, the problem I’m facing is when the access token expires, the refresh API route doesn’t automatically get called. If I refresh the browser, the refresh token gets sent and it works fine again. But the refresh API doesn’t get called like it would’ve if I was using axios (Session.addInterceptors)
r
> Is there a way to “refresh token” on the server (API) side? Not really. Cause the refrsh token is on the frontend.
about refresh not being called, are you querying your API using the JWT from the access token?
c
Wdym?
I simply followed the NextJS guide
Everything seems to work other than the refresh part
r
so trpc won't work with the default setup. When you make trpc calls, does the sAccessToken cookie get sent?
Anyhow, for refreshing to work, we add interceptors to frontend fetch or axios. With trpc, I don’t think the interceptors get applied. There refreshing doesn’t happen on its own
So instead of using the normal sAccessToken, use the JWT in the session with trpc calls
c
I see
Ok I will look into it thanks
Found a way to do it without using JWT
For future reference and for other devs, we simply needed to return this
Copy code
throw new TRPCError({
      code: "UNAUTHORIZED", // UNAUTHORIZED signals 401 which automatically triggers the frontend ST refresh API
      message: error.type,
      cause: error,
    });
r
hmm. Cool!
thanks