CLI demo for @web3auth/node-sdk using custom JWT authentication and Solana signing with @solana/web3.js.
The script in index.js:
- Initializes
Web3Authwith aclientIdandweb3AuthNetwork - Creates a JWT (RS256) from
privateKey.pem - Calls
web3auth.connect({ authConnectionId, idToken }) - Uses the returned Solana signer to:
- print public key
- fetch SOL balance from Solana devnet
- sign a message
cd solana-quick-start
npm install
npm startDev mode:
npm run dev- Create/select a project and copy its
Client ID - Configure a custom auth connection
- Use that connection's
authConnectionId - Ensure JWT validation settings match your token claims and signing key
Then update values in index.js:
clientIdauthConnectionIdweb3AuthNetwork
- Use
authConnectionIdfor custom auth (not legacy verifier parameters). - JWT must include a fresh
iat; old tokens can fail validation. - Wallet continuity depends on keeping
Client ID,web3AuthNetwork, andauthConnectionIdstable.
- The sample balance check uses Solana RPC
https://api.devnet.solana.com. - Sapphire network (
sapphire_devnet/sapphire_mainnet) is separate from Solana devnet/mainnet. - You can test Solana devnet while still using a specific Sapphire environment for key derivation.
- Demo key material and printed tokens are for education only.
- Replace local signing-key usage with your secure auth backend.
- Do not log JWTs or sensitive credentials in production.