I want to have a persistent login, but I can not store the v3 object. Every page refresh I create a new v3 object. Is there a way to use something like useSession, or do I need to create a access token?
I tried to implement the TS version of the PAT, but it seems, that TS os not supporting the PAT for now.
Hello Benedikt,
I too struggled using PAT with the Js/TS API client. I ended up monkey patching the V3 object since it has a private field where the token is stored.
I agree that the best solution would be to implement a setToken method. Maybe @juanf can consider that?
Even if possible to have a public setter for the sessionToken field, I would suggest instead having a constructor that accepts a session token.
In the future, we are going to have transactions, and allowing us to swap the session token in the middle of the transaction might be error-prone since this will also affect the transactionId and interactiveSessionKey fields. So I would like to protect those fields.
I will talk about this with the team and try to add that constructor for the next release.
Is this a good solution for you, or do you see any drawbacks?
Both approaches works well from a developer experience perspective. If the constructor is safer in combination with transactions, it would be very welcome.