Skip to main content

Authentication and bootstrap

Keep the login your customers already use, or connect a new one. DYLI needs a verified customer ID and a Base wallet; it doesn't require a particular login provider.

For a new storefront with your own Privy app, follow the quickstart. This page covers the other options and the configuration returned by GET /bootstrap.

Choose your authentication​

Your setupWhat you configureWho verifies sessions?
Existing login (custom, Auth0, Firebase, etc.)Connect your server identity adapter and wallet providerYour backend
Your own Privy appYour Privy app credentials stay on your serverYour backend with Privy
DYLI-managed loginContact us to activate shared DYLI identity or an isolated provider appDYLI

If your app already has users, they can keep signing in the same way. Your backend verifies their session, looks up their customer ID and wallet, and syncs them with POST /customers. Don't take a customer ID or proof of wallet ownership directly from the browser.

Login and wallet signing are separate. Connect a Base wallet through your existing wallet infrastructure or a wallet provider, even if you already have authentication.

The backend download from API key registration includes your setup, a connection check and an identity adapter to connect to your login. It needs only DYLI_API_KEY for the DYLI connection; your auth provider still needs its own settings. The full storefront template also includes the customer-facing interface and client wallet adapter.

For your own login or Privy app, bootstrap returns auth.mode: existing or privy, verification: partner_server and no DYLI session endpoint. available: true means that mode is registered; you still need to connect and test your adapters. Managed login and existing login with DYLI-managed wallets use /auth/session below.

Optional managed login​

DYLI-managed login (dyli_managed) supports a domain-restricted client under DYLI's Privy app, sharing the same DYLI account and wallet. A separate Privy app is also available when your storefront needs its own users and wallets. Sharing an account does not automatically share a browser session across domains. DYLI confirms which identity setup is activated.

Separate identity is the default. Shared identity is reserved for DYLI-controlled or explicitly trusted storefronts: client IDs do not isolate users, wallets or app access tokens. Privy's access-token audience identifies the parent app, so a backend checking only that audience cannot distinguish its clients. A domain allowlist is not that separation. The Inventory reviewer must acknowledge this trust before activation.

  1. Sign in at Commerce setup, select your app and save its login choice, primary HTTPS origin and additional domains. Do not send keys or secrets.
  2. DYLI finishes the requested provider client or app and activates the setup in Inventory. Status and email update automatically. Creating a Commerce key alone does not do this.
  3. Once GET /bootstrap returns auth.available: true, initialize PrivyProvider with the returned public auth.app_id and auth.client_id when present. auth.identity_scope: dyli identifies shared DYLI identity; partner identifies an isolated provider app. Keep DYLI_API_KEY on your backend; no Privy server secret is needed in your app for this managed flow.
  4. After login, have your backend call /auth/session with the customer's access token, then sync the verified customer and wallet as described below. The full storefront template handles these steps.

If you want to configure login without waiting for DYLI, choose your own Privy app or existing login instead. For an already registered app, save a new setup; rotating the key won't change the saved mode.

Bootstrap​

Call GET /bootstrap with your server API key to read your app's configuration. You don't need a slug setting. A managed-login response includes fields like these:

{
"version": "1.33",
"bootstrap_version": 1,
"environment": "production",
"partner": { "slug": "example-store" },
"auth": {
"mode": "dyli_managed",
"available": true,
"provider": "privy",
"app_id": "public-partner-app-id",
"allowed_origins": ["https://shop.example.com"],
"storefront_origin": "https://shop.example.com",
"session_endpoint": "/auth/session",
"sponsor_transactions": true
},
"wallet": { "chain": "base", "chain_id": 8453 },
"storefront": {
"name": "Example store",
"boxes_only": true,
"community": {
"marketplace": { "ready": true, "include_dyli": false },
"trading": { "ready": true, "include_dyli": false },
"chain_id": 8453,
"settlement": "customer_wallet",
"currency": "USDC"
}
}
}

The IDs and domain above are placeholders. Missing or invalid managed configuration returns auth.available: false, with no usable app ID or storefront origin. Catalog access can still work. Ask DYLI to check the setup; don't use a different auth app as a fallback. Check the API root for available payment methods and pack readiness before checkout.

Send your frontend only the fields it needs, such as the public app ID and display name. Keep your API key, server settings and configured webhook URLs on the backend.

Managed customer verification​

After the customer signs in through your configured Privy app/client, send their access token from your backend:

POST /auth/session
x-api-key: SERVER_DYLI_KEY
x-customer-access-token: CUSTOMER_PRIVY_ACCESS_TOKEN
Content-Type: application/json

{"wallet_address":"0x..."}

wallet_address is optional; if supplied it must be linked to the verified user. DYLI validates the access token with the selected partner app, fetches linked wallet records, and returns:

{
"identity": {
"userId": "did:privy:verified-user",
"externalCustomerId": "privy:verified-user",
"walletAddress": "0x...",
"email": null,
"name": null
}
}

Use the verified identity to sync /customers/{externalCustomerId} and check ownership whenever a customer accesses quotes, orders, pack plays or redemptions. Don't store or log the access token. A login token doesn't prove payment or authorize another wallet.

The endpoint returns 401 for an invalid token, 403 for an unlinked wallet, 409 while the wallet is being created and 503 when managed login is unavailable. It doesn't create an order or charge the customer.

Managed wallets with existing login​

Keep Clerk or another existing JWT login while DYLI operates your embedded-wallet provider. Choose existing login and managed wallets in Commerce setup, then enter the production JWT verification URL. DYLI configures a dedicated provider app with your production JWT verification settings; it does not replace your login with DYLI identity.

After activation, wallet.managed_auth in bootstrap supplies the public app_id, optional client_id, approved origins and /auth/session. Connect your existing login to Privy's JWT authentication and wallet SDK. Your backend first verifies its own customer session, then sends the Privy wallet access token to /auth/session, with external_customer_id equal to that verified customer's original ID and optional wallet_address.

DYLI checks the provider-owned custom_auth record against that ID and verifies the linked wallet. A different customer or missing/ambiguous link returns 403. The response preserves the existing customer ID. Continue using it for /customers and ownership checks. An existing-login bootstrap's auth.available: true describes the login registration; check wallet.managed_auth.available separately before wallet actions.

Approved origins​

Use the HTTPS domain you entered when registering your Commerce app. A temporary HTTPS deployment you control is fine while building; the finished site doesn't need to be live yet. This is a checkout-return allowlist, not just a contact field. Request a domain change before moving to your launch URL. Apex and www are separate origins; redirects don't approve them.

Also add your domains in your own login provider's dashboard; registration with DYLI doesn't update those settings for you. For managed login, DYLI handles the dedicated provider's allowed domains as part of activation.

Checkout can return to a registered HTTPS origin or an exact loopback URL for local development. Don't build return URLs from an untrusted Host header. Native apps need their own provider registration and redirect settings. Use separate auth apps for separate storefronts and environments.

Gas sponsorship​

Approved apps using DYLI-managed wallets can use sponsored pack openings. Read wallet.gas_sponsorship and the managed-auth sponsor_transactions flag from bootstrap. Available managed sponsorship uses Base, alchemy_gas_manager and account_mode: eip7702, with requires_dyli_login: false. Dedicated identity_scope: partner apps keep their existing provider app, wallet addresses, customer IDs and purchased packs.

For managed wallets, use the documented /wallet/intent, /wallet/rpc and /wallet/recovery transport with the customer's verified Privy access token. New customers register the same wallet once. A card payment covers the pack price; opening still requires a customer-signed transaction. Apps operating their own wallets continue using their own Base transaction transport and gas funding or sponsorship.

Test a new customer wallet, existing login, USDC checkout, opening, marketplace and shipping separately. If the wallet cannot sign or receive sponsorship, contact DYLI before enabling live checkout.

Your own auth or processor​

For your own customer EVM wallets, use customer wallet registration before the first customer sync. Your backend authenticates its own user; a short-lived message signed by that user's wallet establishes the Base wallet binding. This works with your existing Privy app without sharing its secret or registering another Commerce application. DYLI creates a generated customer profile when needed and preserves existing usernames and order history.

Your website or mobile app can keep its own checkout and customer balance. Keep your provider credentials on your backend; don't send them to DYLI's login endpoint.

With DYLI's card checkout, you don't need your own Stripe keys. If you use your own card processor, Apple Pay or ledger, charge the customer in your system, then settle the DYLI quote in USDC using the treasury payment flow. DYLI verifies the transfer and payer authorization. A browser success callback or paid: true is not proof of payment.

You can also accept other crypto: use a swap or bridge to fund the customer's or your treasury's Base wallet, then pay the DYLI quote in Base USDC. The customer's payment currency doesn't have to be DYLI's settlement currency.

You handle refunds, disputes and reconciliation for your own checkout. Sell-back USDC goes to the registered customer wallet; it doesn't automatically credit your app's balance.

Choose packs and fees​

Use /config to set your name and catalog_rules.allowed_box_ids. An empty pack filter means all permitted packs, not none. Set {"fee_rules":{"enabled":false}} if you don't want to add a fee. Pack prices, card processing, gas and shipping still apply. The starter also supports pack and fee environment settings.

Before launch, test sign-in, checkout, openings, sell-backs and shipping using the launch checklist.