Conclusion
🎉 Congratulations. You just completed the Tokengated Website with Polkadot and next-auth example. You learned how to use next-auth's composability to write your own CredentialsProvider that authenticates users using their wallets signature and then checking if the free balance of the native token on Kusama chain is > 1.
Further Studies​
If you have a look at the tutorial's github repository you will find more files than we talked about in this demo. E.g. there is a usage example with iron-session for the people who want a more lightweight solution than using next-auth.
Also think about how long you set the valid time for your session cookie.
- https://github.com/vvo/iron-session
- Cookie valid time: https://github.com/vvo/iron-session#session-cookies
- Next JS Docs on Authentication: https://nextjs.org/docs/pages/building-your-application/routing/authenticating
References​
- Simple example using polkadot js and next js on Astar: https://realtakahashi-work.medium.com/astar-next-js-polkadot-js-5cbfe48515ad
- Web3 login for ethereum with next auth: https://web3-sessions.vercel.app/