Connect Zid Store to Odoo ERP
Comprehensive guide to connecting Zid via OAuth, registering webhooks, encrypting tokens with AES-256, and using the Zid Embedded App.
Zid OAuth 2.0 Connection Steps
ERP Link supports official OAuth 2.0 authorization for Zid stores, allowing seamless connection with one click:
- Open your ERP Link dashboard and verify your active workspace.
- From the navigation menu, select Connect Store and choose the Zid tab (
/app/connect-store/zid). - Click Connect Zid Store.
- You will be redirected to Zid's official authorization portal (
oauth.zid.sa). - Review the requested permissions and click Authorize / Install App.
- You will be redirected back to ERP Link, where the authorization code is securely exchanged for an
access_tokenandrefresh_token. - Tokens are encrypted immediately using AES-256-GCM before database storage (
src/lib/crypto.ts).
The platform automatically refreshes the access token prior to expiration using a single-flight mutex lock, preventing simultaneous duplicate token refreshes.
Required Scopes & Permissions
ERP Link requests only necessary operational permissions:
- Orders: Read orders, line items, customer shipping addresses, and payment statuses.
- Products & Inventory: Read product variants, barcodes, and SKUs; update available quantities.
- Customers: Read customer profiles, phone numbers, and emails to map contacts in Odoo.
- Webhooks: Register real-time event webhooks.
Webhook Ingress & Security
Upon authorization, ERP Link subscribes to key store lifecycle events:
order.create— Triggers upon new checkout completion.order.status.update— Triggers upon status transition (Confirmed, Preparing, Shipped, Cancelled).product.create/product.update— Triggers upon catalog or inventory adjustments.
To guard against spoofing, the Zid ingress endpoint (`/api/webhooks/zid`) is protected by **HTTP Basic Auth** derived via **HKDF-SHA256** per workspace. Unauthenticated deliveries are rejected immediately with `401 Unauthorized`.
Zid Embedded App within Dashboard
You can access ERP Link directly within your Zid merchant admin:
- Open your Zid Dashboard and navigate to App Market > Installed Apps > ERP Link.
- The platform loads securely inside the admin iframe.
- A single-use ticket exchange mechanism authenticates your merchant session automatically without re-entering credentials.
Common Errors & Troubleshooting
- "Zid Store Disconnected" or "Invalid Token":
* *Cause:* App uninstalled in Zid admin, or refresh token expired after extended downtime.
* *Resolution:* Click Reconnect on the Zid settings page to refresh OAuth permissions.
- Order not arriving after creation in Zid:
* *Check:* Inspect Sync Logs or Queue. If absent, verify that webhooks are active or click Refresh Webhooks to re-register subscriptions.
Encountered an issue applying this guide?
Open a support ticket to have our engineering desk inspect logs directly.