This is the web server component of the SolanaLogin project, handling Solana wallet authentication for the Minecraft plugin.
- Solana wallet authentication through blockchain signatures
- Support for Phantom browser extension connections
- QR code generation and handling for Phantom mobile app
- Integration with Solana devnet network
- RESTful API for interaction with the Minecraft plugin
-
Install Node.js (version 14 or higher)
-
Install dependencies:
npm install
-
Start the server:
npm start
The server will run on port 3000 by default. You can change this by setting the PORT environment variable.
GET /login- Login pageGET /api/qr- Generate QR code for mobile connectionPOST /api/verify- Verify wallet signatureGET /status- Check connection statusGET /phantom-redirect- Handle redirect from Phantom
The web server includes several test pages to help debug wallet connection issues:
-
Test Flow:
/test-flow.htmlAccess http://localhost:3000/test-flow.html- Test the complete wallet connection flow
- Create session, connect wallet, and verify connection
-
Simple Connect:
/simple-connect.html- Test basic connection with Phantom extension
- Test message signing
-
Simple QR:
/simple-qr.html- Test QR code generation and scanning
- Test deep linking for Phantom mobile
-
Simple Redirect:
/simple-redirect.html- Test Phantom redirect handling
- Test URL parameters
Make sure the URL in the Minecraft plugin's config.yml file matches the URL where this web server is running:
web-server:
enabled: true
url: "http://localhost:3000" # Change to your server's URL
port: 3000
qr-code-timeout: 300
check-interval: 5The server includes a development mode that makes debugging easier:
// Set development mode for testing
process.env.NODE_ENV = 'development';In development mode:
- Missing parameters will be auto-filled with test values
- Signature verification is more lenient
- More detailed logging is enabled
To run in production mode, set NODE_ENV=production in your environment variables.
- Optimized code structure with utility functions
- Improved signature handling from Phantom wallet
- Fixed "Empty signature" error when connecting from Minecraft
- Added multiple fallback methods for signature handling
- Improved UI and user experience
- Added more detailed logging for easier debugging
- Switched to Solana devnet network
- Improved Phantom wallet connection handling
- Fixed "Missing required parameters" error during signature verification
- Simplified deep link format for Phantom wallet
- Added development mode for easier debugging
- Improved error handling and logging
- Added simple test pages for wallet connection debugging
- "Missing required parameters" error: Ensure the login URL contains all required parameters: session, nonce, and player.
- Cannot connect to Phantom: Check that the Phantom extension is installed and logged in.
- QR code not working: Make sure the Phantom app is updated to the latest version.
- Signature verification fails: Try using the Simple Connect test page to verify that signature generation works correctly.
- Check the console logs for detailed error messages
- Use the test pages to isolate specific components of the authentication flow
- Ensure your Phantom wallet is connected to the correct Solana network (devnet)
- Verify that CORS is properly configured if accessing from a different domain