Overview
SEP-10 (Stellar Web Authentication) enables wallet applications to create authenticated sessions with Stellar anchors by proving control over a Stellar account. Once authenticated, wallets receive a JSON Web Token (JWT) that they use in subsequent requests to the anchor’s standardized services. For the complete specification, see SEP-10: Stellar Web Authentication. The Anchor Platform implements SEP-10 with support for:- Challenge/Response Flow: GET
/authto request a challenge, POST/authto validate and receive a JWT - Client Attribution: Optional verification of client application identity for noncustodial wallets
- Custodial Wallet Support: Support for custodial wallets that manage user accounts
- Multiple Home Domains: Support for multiple domains and wildcard patterns
Typical Authentication Flow
- The Client requests a unique challenge from the Server
- The Client verifies and signs the challenge
- The Client submits the signed challenge to the Server
- The Server verifies the challenge and responds with a JWT session token
Enable SEP-10
To enable SEP-10, set the following environment variables in yourdev.env file.
Required Configuration (If Enabled)
Optional Configuration
Client Attribution
Client attribution allows you to restrict authentication to specific wallet applications and verify their identity. This is an optional feature that should only be enabled if it’s a business requirement.By default, the Anchor Platform allows anyone with a Stellar account to authenticate. Client attribution is only needed if you want to:
- Restrict authentication to specific wallet applications
- Verify the identity of noncustodial wallet applications
- Track which wallet applications your users are using
Enabling Client Attribution
SEP10_CLIENT_ATTRIBUTION_REQUIRED=true, noncustodial wallets must:
- Provide a
client_domainparameter in the challenge request - Sign the challenge transaction with the
SIGNING_KEYfrom that domain’sstellar.tomlfile - Have their domain listed in your client configuration
Client Configuration
Configure allowed clients in your YAML configuration file:Configure stellar.toml
Update yourstellar.toml file to advertise SEP-10 support. Wallets discover your authentication endpoint through this file.
WEB_AUTH_ENDPOINT - The URL where the authentication service is running. This is the URL that clients will use to authenticate with the anchor. The endpoint must support:
GET <WEB_AUTH_ENDPOINT>- Request a challengePOST <WEB_AUTH_ENDPOINT>- Exchange signed challenge for session JWT
SIGNING_KEY - The public key corresponding to the private key specified in SECRET_SEP10_SIGNING_SEED. This key is used to sign authentication challenges presented to wallet applications.
How to Test the Authentication Flow
The SEP-10 authentication flow consists of two steps:-
GET
/auth- Request a challenge transaction- Parameters:
account(required),memo(optional),home_domain(optional),client_domain(optional) - Returns: A challenge transaction in XDR format
- Parameters:
-
POST
/auth- Validate the signed challenge and receive a JWT- Body:
{ "transaction": "<signed_challenge_xdr>" } - Returns:
{ "token": "<jwt_token>" }
- Body:
Authorization header.