3U

Authentication

How authentication works across the ThreeU developer platform.

Authentication Overview

ThreeU uses token-based authentication across all APIs. Every API request must include a valid token in the Authorization header. Different contexts require different token types, each with specific security requirements and permission scopes.

Bearer Token Authentication

All authenticated API requests use the Bearer token scheme:

Bearer Token Request
Shell
curl -X GET https://api.threeu.app/api/plugins/installed \
  -H "Authorization: Bearer YOUR_TOKEN_HERE" \
  -H "platform-id: my-store" \
  -H "Content-Type: application/json"

Developer Authentication

Developers authenticate through a dedicated flow:

  1. Apply — Submit a developer application through ThreeU
  2. Approval — ThreeU reviews and provisions a developer account with status pending
  3. Invite — An invitation email is sent to the developer
  4. Accept — Developer calls POST /developer/accept-invite to activate
  5. LoginPOST /developer/login returns a bearer token
  6. BootstrapGET /developer/me loads the profile
Developer Auth Flow
TypeScript
// Accept invite
const response = await fetch('https://api.threeu.app/api/developer/accept-invite', {
  method: 'POST',
  headers: { 'Content-Type': 'application/json' },
  body: JSON.stringify({
    email: '[email protected]',
    password: 'secure_password',
    password_confirmation: 'secure_password'
  })
});

// Login
const loginRes = await fetch('https://api.threeu.app/api/developer/login', {
  method: 'POST',
  headers: { 'Content-Type': 'application/json' },
  body: JSON.stringify({ email: '[email protected]', password: 'secure_password' })
});
const { token } = await loginRes.json();

Token Safety Rules

Different tokens have different security requirements:

Token TypeSafe in Browser?Use Case
Secret Admin Token❌ NeverServer-side admin operations
Public Storefront Token✅ YesClient-side storefront data
Plugin Installation Token❌ NeverPlugin-to-ThreeU communication
POS Token⚠️ Device onlyPoint-of-sale terminal sessions
Theme Development Token✅ YesTheme preview and development
Developer API Token❌ NeverDeveloper console API calls

Critical Security Warning

Secret Admin Tokens must never be exposed in the browser, client-side code, or public repositories. Always use environment variables and server-side code.