Authentication
Overview
Why Token-Based Authentication?
Authentication Flow
┌─────────────────┐ ┌─────────────────┐ ┌─────────────────┐
│ Your │ │ Your │ │ Alternative │
│ Backend │ │ Frontend │ │ API │
└────────┬────────┘ └────────┬────────┘ └────────┬────────┘
│ │ │
│ 1. POST /v1/checkout-auth/init │
│ (with OAuth2 client credentials) │
│──────────────────────────────────────────────>│
│ │ │
│ 2. Returns JWT token │
│<──────────────────────────────────────────────│
│ │ │
│ 3. Pass token to frontend │
│──────────────────────>│ │
│ │ │
│ │ 4. SDK uses token │
│ │ for all API calls │
│ │──────────────────────>│
│ │ │
│ │ 5. Token expires │
│ │ onAccessTokenExpired │
│ │ callback triggered │
│ │<─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─│
│ │ │
│ 6. Frontend requests │ │
│ new token │ │
│<──────────────────────│ │
│ │ │
│ 7. New token returned│ │
│──────────────────────>│ │
│ │ │
│ │ 8. SDK continues │
│ │ with new token │
│ │──────────────────────>│Backend Implementation
Step 1: Get OAuth Token
Step 2: Generate Checkout Token
Complete Backend Example
Frontend Implementation
Initialize with Token
Handle Token Expiration
Error Handling
Security Best Practices
Token Contents
Claim
Description
Last updated
Was this helpful?
