can someone point me to the doc where you can "des...
# general
f
can someone point me to the doc where you can "destroy" session after a certain amount of time, forcing the user to relogin?
r
Hey @funk101
f
yes?
hey
r
You mean you want to log the user out even if they are active?
f
yes sir
r
Right. So you can do that by overriding the refresh API. Start by calling the original implementation to get the session object
Then from the session object, you can get the time the session was created
If that time is before your threshold, then call the revokeSession function on the session object.
Then user should be logged out
f
not sure where this should take place
r
Refresh function override
In session.init
On the backend
f
cool
I'm going down the right path here?
Copy code
override: {
          apis: (originalImplementation) => {
            return {
              ...originalImplementation,
              refresh: async function (input) {
                if (originalImplementation.refresh === undefined) {
                  throw Error("Shouldn't hit this"); // TODO: figure this out
                }
                try {
                  const session = await originalImplementation.refresh(input);
                  console.log("Session: ", session);
                } catch (err) {
                  throw Error(err);
                }
              },
r
Yes
f
of course that console.log(session) does nothing
r
Please make sure that you are using the other function. I suggest going through the node SDK reference docs. Thanks
f
so that should be in SessionNode.init(),
?
r
Yes. Once again, pls see our docs.
If you want help that requires a lot of hand holding, you can start a subscription with us for dedicated support. Hope this makes sense
3 Views