I'm quite new to blockchain and was wondering if someone can help me regarding the session persistence on Web3 applications. I come from a Web2 background with experience in developing websites in Laravel / PHP and all of these things are quite new to me.

As far as I can tell, when creating Web3 applications which would have a wallet login I'm supposed to use external sources e.g. PhantomJS for their wallet or any of the available packages with Wallet Adapters. The thing is, as soon as I refresh the website, the connection to that adapter is lost. Is this a must? Is there no session persistence between pages? Does this mean that every single Web3 app should be SPA ? Is there a way to use both frontend login via wallet as well as some sort of session persistence in the backend in order to serve user-specific data?

Any help would be appreciated, thanks in advance!

1 Answer 1


While there is no one to one mapping of sessions like in web2.0, solana wallet adapter provides autoConnect when used, automatically connects a user's wallet to the website on a refresh.

from the docs on how to use it in a react app:

example docs

  • 1
    Thanks for the answer! Yeah, I've noticed that option as well, but the thing is, I'm really concerned about safety when working with frontend only (as a mean of authentication), I have no clue what could go wrong and why, in that regard I would be far better off if there was a way of being able to create a temporary session on backend based on some unique token (which would always be the same for that wallet) and then validate data based on that. Commented Oct 3, 2022 at 11:41
  • @BlockchainSolanaDev101 The wallet adapter is taking care of security aspects so using autoConnect should be fine. Also, using backend just to authentificate between pages is overkill and misused concept. Cookies and tokens are used to authentificate on backend, which you do not have any, so it should not be on your frontend app as well.
    – Void
    Commented Oct 3, 2022 at 22:43

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.