OAuth apps
OAuth lets any Lumora business connect your app in two clicks, choose exactly what it may see, and disconnect it at any time. Lumora implements the OAuth 2.0 authorization code flow with PKCE.
Create an app
In the developer console, choose New app. Give it a name and description (businesses see these on the consent screen), its redirect addresses, and the scopes it may ask for. Redirect addresses must be https, or http://localhostwhile you develop, and must match exactly.
Every app has two sets of credentials:
- Sandbox, client ID
lmo_sbx_…: connects only sandbox businesses. Use it while you build. - Production, client ID
lmo_app_…: connects only real businesses.
Each has its own client secret (lmo_cs_…), shown once. Roll it from the app page if it leaks.
1. Send the business to Lumora
Link the owner to the consent screen with your client ID, a redirect address, the scopes you need and a random state:
https://app.buziin.tech/oauth/authorize
?client_id=lmo_app_8KqW2nZ...
&response_type=code
&redirect_uri=https://yourapp.co.tz/lumora/callback
&scope=orders.read customers.read catalog.write
&state=Rk3n9...
&code_challenge=E9Melhoa2OwvFrEMTJguCHaoeK1t8URWbuGJSstw-cM
&code_challenge_method=S256| Parameter | Notes |
|---|---|
client_id | Sandbox or production client ID. |
redirect_uri | One of the app's redirect addresses. May be left out if the app has exactly one. |
scope | Space-separated scopes, each one the app is set up to ask for. Write scopes include read. |
state | A random value you check on the callback, against cross-site request forgery. |
code_challenge | PKCE: the base64url SHA-256 of a random verifier you keep. Required for apps without a secret (mobile, desktop, single-page), recommended for all. |
The owner or an admin signs in, picks the business, sees your app's name, website and the permissions in plain words, and approves. Only owners and admins can connect apps.
2. Handle the callback
Lumora redirects to your address with ?code=…&state=…, or ?error=access_denied&state=… if the owner declined. Check state, then swap the code for tokens within ten minutes. A code works once.
curl https://api.buziin.tech/oauth2/token \
-u "$LUMORA_CLIENT_ID:$LUMORA_CLIENT_SECRET" \
-d grant_type=authorization_code \
-d code=$CODE \
-d redirect_uri=https://yourapp.co.tz/lumora/callback \
-d code_verifier=$VERIFIER{
"access_token": "lmo_at_3qT9vXb2...",
"token_type": "bearer",
"expires_in": 86400,
"expires_at": "2026-12-06T09:30:00Z",
"refresh_token": "lmo_rt_Hs81kLp...",
"refresh_token_expires_in": 7776000,
"scope": "catalog.write customers.read orders.read",
"business_id": "0193a4f2-0a77-7c41-8e0b-3d2b9f6e1a55",
"environment": "production"
}Store both tokens against business_id, encrypted. The token endpoint takes form-encoded or JSON bodies, and client credentials either as HTTP basic auth or as client_id and client_secret fields.
3. Call the API
Use the access token exactly like an API key: Authorization: Bearer lmo_at_…. A call outside the granted scopes fails with permission_denied and names the scope it needs.
4. Refresh
Access tokens last 24 hours. Refresh tokens last 90 days and are single use: refreshing returns a new pair and ends the old one, so save the new refresh token before you use the access token. A business that keeps using your app stays connected indefinitely.
curl https://api.buziin.tech/oauth2/token \
-u "$LUMORA_CLIENT_ID:$LUMORA_CLIENT_SECRET" \
-d grant_type=refresh_token \
-d refresh_token=lmo_rt_...Disconnecting
A business can disconnect your app from Connected apps on its Developers page; its tokens stop working at once and its webhook stops. To disconnect from your side, revoke either token at POST /oauth2/revoke with token=…. Connecting the same business again replaces the old connection.
Errors
The token endpoint answers errors as RFC 6749 JSON, {"error": "invalid_grant", "error_description": "..."}:
| Error | Meaning |
|---|---|
invalid_request | A parameter is missing or malformed. |
invalid_client | Unknown client ID, or a missing or wrong secret. Sandbox and production secrets are different. |
invalid_grant | The code or refresh token is wrong, used, expired or revoked; or the redirect address or PKCE verifier doesn't match. |
unsupported_grant_type | Only authorization_code and refresh_token. |
slow_down | More than 60 token requests a minute from one client. Wait for Retry-After. |