Hello,
How to keep user logged in when using web3 single auth. The user is disconnected when I refresh the page. I have this issue also with the example.
I did exactly like the example, I added nothing. In the example, if you refresh the page after login, you will need to log in again. Do I need to store something from web3auth?
This is(https://main.d2lp336n532me9.amplifyapp.com/) hosting the same app from the examples repo.
And I could see the persisted login upon page refresh. Can you confirm what’s your state with this live demo?
Here is a link to a video recording, so you understand better my issue.
This is expected behaviour. Currently Session Management is not supported in the Core Kit products, which includes this Single Factor Auth SDK.
We will be soon releasing an SDK to help maintain a session within Core Kit products.
For now the recommended way for maintaining a session will be to encrypt the private key using some session key (stored in your backend). You can store the encrypted private key in the browser session/ local storage according to your preference and according to the set time limit of your session, you can decrypt and login the user if the session key is found.
I hope that solves this problem for now.
I am not sure to understand. So, I need to use the web3auth Node.js SDK to get the private key from the idtoken and then encrypt it to send to the front-end ? Then I would need to decrypt the private key, so I can interact with smart contracts using ether?
Is it possible to have a call to get deeper explanation about how to implement this.
This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.