How can i manually store the Session object after the login process?

Hi to everyone,

I’m currently working with the “@inrupt/solid-client-authn-node” library. I’m developing a sort of middleware server, that after an authentication stores the session of the login in memory.
The way in which i’m executing the login is by using

var session=await client.login( 
          idp:...
          username: .....
          password: ......
          oidcIusser: .....
)

The login actually works fine, but i’dont’ know how to manually store the Session object retrived from the process, in the session memory, in order to fetch the next calls.
Thank you for your help!

Hello @ValerioGoretti, thanks for reaching out !

I’m not sure I fully understand the question: what do you mean by “storing in the session memory” ? If you want to persist the session so that it can be logged back in even if the session object goes out of scope or the server is stopped and restarted, you’ll have to provide an external storage to the Session constructor. An example of this is available in the solid-client-authn-node repo. Note that if you only need in-memory persistence, that’s the default behaviour, and you can still manipulate the session beyond the scope where the object lives. For this, you have another example in the repo.

Does this help ? Otherwise, can you expand a bit on the issue you want to solve ?