Commerce · Auth · OAuth2

User Authentication & Accounts

Independent commerce user registry — completely separate from ERP users. Google & Apple Sign-In, email/password, opaque session cookies, address book, GDPR compliance.

Google OAuth2 Apple Sign In httpOnly Sessions Address Book GDPR

Key capabilities

Commerce users are a completely independent registry — ERP employees cannot log into the storefront and vice versa. Each has their own JWT signing key, session lifetime and session table.

Google Sign-In

OAuth2 redirect flow with PKCE state. Finds or creates a commerce user by email. Links multiple providers to one account.

Apple Sign In

Supports privacy-relay emails. Works on first login only (Apple hides email on repeat). Same find-or-create flow.

Email / Password

bcrypt-hashed passwords, email verification link, forgot/reset password flow, change password.

Session Security

32-byte random token → SHA-256 hash stored in DB. httpOnly SameSite=Lax cookie. Expires in 7 days. Multiple active sessions supported.

OAuth2 PKCE bcrypt httpOnly cookie GDPR ready Address book Order history
Увійти Відстежуйте замовлення та залишайте відгуки G Увійти через Google Увійти через Apple або Email Пароль Забули? Увійти Немає акаунту? Зареєструватися → Реєструючись, ви погоджуєтеся з умовами · GDPR POST /api/v1/commerce/auth/register · /login · /oauth/google · /oauth/apple · commerce_sessions (httpOnly)
ІВ Іван Василенко ivan@example.com ✓ Email підтверджено Вийти 📦 Замовлення ❤️ Бажання 👤 Профіль 🔒 Безпека ORD-8FA2 Гербімакс 500 SC × 2 · Акт + ПН ✓ ✓ Доставлено ₴ 5 600 ORD-2C19 Гліфосан 480 SL × 5 · net-30 ⏳ Очікує ₴ 7 500 ⚡ SSE: зміна статусу замовлення оновлюється в реальному часі GDPR · Мої дані 📥 Завантажити дані 🗑 Видалити акаунт GET /api/v1/commerce/users/me · /me/orders · /me/wishlist · DELETE /me (GDPR anonymize) · GET /me/export

Auth lifecycle

1

Register or Sign In

Email/password or Google/Apple OAuth2. Welcome email sent with verification link.

2

Session created

32-byte random token → SHA-256 hash in commerce_sessions. httpOnly SameSite=Lax cookie set. SSR-compatible.

3

Browse & Shop

Heart button on products → wishlist. Product ratings and reviews require auth. Address book pre-fills checkout.

4

Track orders in real-time

SSE stream on /orders/:id/status-stream — updates status without page reload.

5

GDPR rights

Download all personal data as JSON. One-click account deletion — data anonymized, sessions revoked, OAuth accounts unlinked.

Related modules