WeSearch

Connecting Phantom to a Web App Changed How I Think About "Login"

·2 min read · 0 reactions · 0 comments · 0 views
Connecting Phantom to a Web App Changed How I Think About "Login"

On Day 4 of #100DaysOfSolana, I built a small Vite app that connects to a browser wallet. The feature...

Original article
DEV Community
Read full at DEV Community →
Full article excerpt tap to expand

try { if(localStorage) { let currentUser = localStorage.getItem('current_user'); if (currentUser) { currentUser = JSON.parse(currentUser); if (currentUser.id === 3822717) { document.getElementById('article-show-container').classList.add('current-user-is-article-author'); } } } } catch (e) { console.error(e); } Tanisha fonseca Posted on Apr 28 Connecting Phantom to a Web App Changed How I Think About "Login" #100daysofsolana #web3 #solana #beginners On Day 4 of #100DaysOfSolana, I built a small Vite app that connects to a browser wallet. The feature itself is maybe 30 lines of code. The mindset shift it triggered is harder to measure. What I Built A minimal web app that: Detects installed wallets using getWallets() from @wallet-standard/app Filters for Solana-compatible wallets by checking wallet.chains Prompts Phantom to connect with one button click Displays the connected address and devnet balance import { getWallets } from "@wallet-standard/app"; const { get } = getWallets(); const solanaWallets = get().filter(wallet => wallet.chains.some(chain => chain.startsWith("solana:")) ); Enter fullscreen mode Exit fullscreen mode No API keys. No backend. No session management. The wallet handles all of it. What Surprised Me In Web2, "Sign in with Google" feels like a convenience feature, you're still handing your identity to Google, who hands a token to the app. The app trusts Google. You trust Google. Everything flows through Google. With Phantom, the app never sees your private key. It never talks to a central auth server. It sends a connection request to your wallet extension, which prompts you to approve it. If you approve, the app gets your public address, nothing more. Every subsequent action that needs your signature goes through the same approval flow. The trust model is completely inverted. The app doesn't authenticate you. You authenticate yourself, and the app just observes the result. "Sign in with Phantom" isn't "Sign in with Google for Web3." It's closer to showing your passport, the app sees proof of who you are, but it never holds the passport. What's Next Week 2 is about writing transactions and moving tokens on-chain. I'm looking forward to seeing how that signing flow works end-to-end from the user clicking a button, to Phantom prompting for approval, to the transaction landing on devnet. If you're following along, drop your wallet setup experience below. Did anything about the browser wallet model surprise you? Part of my #100DaysOfSolana journey. Top comments (0) Subscribe Personal Trusted User Create template Templates let you quickly answer FAQs or store snippets for re-use. Submit Preview Dismiss Code of Conduct • Report abuse Are you sure you want to hide this comment? It will become hidden in your post, but will still be visible via the comment's permalink. Hide child comments as well Confirm For further actions, you may consider blocking this person and/or reporting abuse

This excerpt is published under fair use for community discussion. Read the full article at DEV Community.

Anonymous · no account needed
Share 𝕏 Facebook Reddit LinkedIn Email

Discussion

0 comments

More from DEV Community