Overview
Auction Excellence uses Supabase Auth for authentication, providing secure JWT-based access to all API resources. Authentication is required for all API endpoints except public resources.JWT Tokens
Secure JSON Web Tokens with 1-hour expiry and automatic refresh
Multi-Tenant
Auction-scoped access with role-based permissions
Row Level Security
Database-enforced security policies on all tables
Real-time Auth
WebSocket authentication for live features
Authentication Methods
Email & Password
The primary authentication method for Auction Excellence. Users sign up with email and password, then sign in to receive JWT tokens.- Sign Up
- Sign In
- Sign Out
Password Reset
Users can request a password reset email and then update their password.1
Request Reset Email
2
User Clicks Email Link
The email contains a link with a recovery token that redirects to your app.
3
Update Password
JWT Token Format
Auction Excellence uses standard JWT tokens with custom claims for multi-tenant authorization.Token Structure
Decoded Payload
Key Claims
| Claim | Description |
|---|---|
sub | User’s unique UUID (used for all database operations) |
exp | Token expiration timestamp (1 hour from issue) |
iat | Token issue timestamp |
role | Always authenticated for logged-in users |
aal | Authentication Assurance Level |
session_id | Unique session identifier for this login |
Token Refresh Flow
Access tokens expire after 1 hour. Use refresh tokens to obtain new access tokens without requiring the user to sign in again.Client SDK Handling
The Supabase client SDKs handle token refresh automatically:- JavaScript
- React Native
Using Tokens in API Requests
All authenticated API requests require the JWT token in the Authorization header.Required Headers
| Header | Required | Description |
|---|---|---|
apikey | Yes | Your Supabase project’s anon key |
Authorization | Yes | Bearer + your JWT access token |
Content-Type | For POST/PUT | Usually application/json |
Multi-Tenant Authorization
Auction Excellence uses a multi-tenant architecture where users belong to one or more auctions (organizations). Authorization is enforced at multiple levels.Auction Roles
| Role | Permissions |
|---|---|
owner | Full access, can transfer ownership, delete auction |
admin | Manage users, locations, settings; view all data |
team_member | Submit data, view assigned locations |
Authorization Flow
1
User Authenticates
User signs in and receives JWT token with their
user_id2
RLS Checks Membership
Row Level Security policies check
auction_members table3
Role Determines Access
User’s role in the auction determines what actions they can perform
Helper Functions
The API provides helper functions to check authorization:Super Admin Access
Super admins have system-wide access across all auctions. This is a special privilege granted at the database level.Super admin status is stored in the
super_admins table and bypasses normal RLS policies.Session Management
Get Current Session
Update User Profile
Error Responses
Authentication errors return standard HTTP status codes with descriptive messages.Common Errors
| Status | Error | Description |
|---|---|---|
| 400 | invalid_grant | Invalid email/password combination |
| 400 | user_already_exists | Email already registered |
| 401 | invalid_token | JWT token is invalid or expired |
| 401 | not_authenticated | No Authorization header provided |
| 422 | weak_password | Password doesn’t meet requirements |
| 429 | rate_limit_exceeded | Too many requests |
Error Response Format
Handling Token Expiration
When a token expires, you’ll receive a 401 response:Security Best Practices
Store tokens securely
Store tokens securely
- Mobile: Use secure storage (iOS Keychain, Android Keystore)
- Web: Use HTTP-only cookies or secure localStorage
- Never expose tokens in URLs or logs
Use HTTPS only
Use HTTPS only
All API requests must use HTTPS. HTTP requests will be rejected.
Handle token refresh
Handle token refresh
Implement automatic token refresh to prevent session interruption. The Supabase SDK handles this automatically.
Validate on the server
Validate on the server
Always validate tokens server-side. RLS policies enforce this automatically.
Rate Limiting
Authentication endpoints have rate limits to prevent abuse:| Endpoint | Limit |
|---|---|
| Sign In | 30 requests per hour per IP |
| Sign Up | 5 requests per hour per IP |
| Password Reset | 5 requests per hour per email |
| Token Refresh | 60 requests per hour per user |