ShopAll · Developers · OAuth
OAuth for apps
Build one app that many ShopAll stores can connect. Each store owner sees your app's name and exactly what it may do, and approves or denies. You get a token for that one store only.
1. Register your app
In your own ShopAll dashboard open Apps I built, give the app a name, its redirect addresses (https, exact) and the scopes it may ask for. The client secret (sas_…) is shown once; keep it on your server. You can rotate it there; the old secret stops at once.
2. Send the owner to the consent screen
Make a new state and PKCE pair for every sign-in:
import base64, hashlib, secrets
verifier = secrets.token_urlsafe(64)[:96] # keep it on your server, per sign-in
challenge = base64.urlsafe_b64encode(hashlib.sha256(verifier.encode()).digest()).rstrip(b"=").decode()
state = secrets.token_urlsafe(24) # store it in the user's sessionhttps://shopallapp.com/oauth/authorize?client_id=sapp_...
&redirect_uri=https%3A%2F%2Fyourapp.example%2Fcallback
&scope=read_products%20read_orders
&state=STATE&code_challenge=CHALLENGE&code_challenge_method=S256
redirect_urimust equal a registered address character for character.stateis required (8 to 200 characters) and comes back unchanged. Check it.- PKCE with
S256is required;plainis refused. scopeis space-separated and may only contain scopes the app registered.
After approval the owner returns to redirect_uri?code=sac_…&state=…; after a denial to redirect_uri?error=access_denied&state=….
3. Exchange the code
curl https://shopallapp.com/api/oauth2/token \
-d grant_type=authorization_code -d code=sac_... \
-d redirect_uri=https://yourapp.example/callback -d code_verifier=VERIFIER \
-u sapp_...:sas_...
The code works once and for 5 minutes. A second use is treated as theft: every token of that approval is revoked. The answer has access_token (sat_…, 60 minutes), refresh_token (sar_…, 30 days), scope and store_id.
4. Call the API
Use Authorization: Bearer sat_… on any /api/v2/open endpoint. The token sees only the store that approved it, with only the approved scopes.
read_products: read products, their options and stockwrite_products: change product details and prices (not stock, not cost)read_orders: read orderswrite_orders: create orders and move them through their statusesread_customers: read customerswrite_fulfillment: write fulfillment
5. Refresh and revoke
grant_type=refresh_token with the refresh token and your client credentials gives a new pair; the old pair stops working. Reusing an old refresh token revokes the whole approval. To disconnect, POST token to /api/oauth2/revoke (always answers 200). The store owner can also disconnect your app at any time from Connected apps; your tokens then answer 401.
6. App webhooks
Set one endpoint and the events you want under Apps I built → App webhook. Every store that installs your app delivers its events there, and stops when it disconnects. Deliveries are signed exactly like store webhooks: X-ShopAll-Signature: t=<unix time>,v1=<hex>, HMAC-SHA256 of "<t>." + raw body with your app's signing secret (shown once). Refuse a t more than 5 minutes from your clock, so a captured delivery can't be replayed. Failed deliveries are retried with backoff (1, 5, 30, 120 and 360 minutes); the delivery log shows every attempt, and you can redeliver one or send a test event.
7. App review
A new app is a draft. You can always install and use it on your own store. Send it for review when it is ready; a ShopAll admin approves or rejects it with a note. When ShopAll turns on review for installs, only approved apps can be installed on other stores.
Errors
401 invalid_client: wrong client id or secret400 invalid_grant: code or refresh token unknown, expired, used, or the redirect_uri / code_verifier does not match400 unsupported_grant_type
Every approval, denial, token and refused attempt is recorded in the store's OAuth audit log.