This server facilitates communication between the Decentraland client and the auth dapp on the browser. It allows the client to execute wallet methods (eth_sendTransaction, personal_sign, etc.) using the wallet the user has on their browser by leveraging the auth dapp.
- Authentication Request Management: Creates, stores, and manages authentication requests with automatic expiration (default: 5 minutes).
- WebSocket Real-Time Communication: Provides Socket.IO-based real-time communication for instant request/response handling between clients and the auth dapp.
- HTTP Polling Support: Offers REST endpoints as an alternative to WebSocket for environments where WebSocket is not available.
- Identity Management: Supports temporary identity creation and retrieval for auto-login flows.
- Signature Validation: Validates Ethereum signatures using
@dcl/cryptoAuthenticator to ensure requests are authorized. - Verification Codes: Generates random verification codes (0-99) for visual confirmation between client and auth dapp.
This service interacts with the following services:
- Auth dApp: The browser-based application that executes wallet methods on behalf of the user using their connected wallet.
- Decentraland Client: The desktop application that initiates authentication requests.
External dependencies:
- @dcl/crypto: For Ethereum signature validation
- @dcl/schemas: For Decentraland schema types and validation
- Socket.IO: For WebSocket real-time communication
The API is fully documented using the OpenAPI standard. Its schema is located at docs/openapi.yaml.
Before running this service, ensure you have the following installed:
- Node.js: Version 22.x or higher (LTS recommended)
- Yarn: Version 1.22.x or higher
- Docker: For containerized deployment (optional, for integration testing)
- Clone the repository:
git clone https://github.com/decentraland/auth-server.git
cd auth-server- Install dependencies:
yarn install- Build the project:
yarn buildThe service uses environment variables for configuration.
Create a .env file in the root directory containing the environment variables for the service to run.
Use the .env.default variables as an example.
To run the service in development mode:
yarn start:devTo run the compiled service:
yarn startThis service includes comprehensive test coverage with both unit and integration tests.
Run all tests with coverage:
yarn testRun tests in watch mode:
yarn test:watchRun only unit tests:
yarn test test/unitRun only integration tests:
yarn test:integration- Unit Tests (
test/unit/): Test individual components and functions in isolation - Integration Tests (
test/integration/): Test the complete request/response cycle
For detailed testing guidelines and standards, refer to our Testing Standards documentation.
The server includes a backend-driven email nudge system that detects when users stall during onboarding and sends contextual recovery emails via SendGrid.
These endpoints are only mounted when ONBOARDING_ADMIN_ENABLED=true in .env. They are disabled by default in production.
Triggers the nudge evaluator manually (same logic the cron runs every 15 min). Finds users stuck at each checkpoint for 12h/24h/36h and sends the appropriate email.
curl -X POST http://localhost:8080/admin/onboarding/run-evaluatorSends a nudge email directly to a specific address, bypassing the database. Useful for previewing SendGrid templates.
# Send CP3 sequence 1 email to your inbox
curl -X POST http://localhost:8080/admin/onboarding/send-test-email \
-H 'Content-Type: application/json' \
-d '{"to": "you@example.com", "checkpointId": 3, "sequence": 1}'
# Send CP1 sequence 2
curl -X POST http://localhost:8080/admin/onboarding/send-test-email \
-H 'Content-Type: application/json' \
-d '{"to": "you@example.com", "checkpointId": 1, "sequence": 2}'Parameters:
to(string) — recipient email addresscheckpointId(1–7) — which checkpoint's content to usesequence(1, 2, 3) — which SendGrid template to use
Returns users that would receive an email on the next cron run for a given sequence.
# Check who's pending for sequence 1 (12h)
curl http://localhost:8080/admin/onboarding/pending-nudges/1
# Response:
# {"sequence":1,"count":2,"nudges":[{"userId":"user@test.com","checkpointId":2,"email":"user@test.com"},...]}}To understand more about how the server works with this requests, see docs/requests.md.
For detailed AI Agent context, see docs/ai-agent-context.md.