Skip to main content
Use OAuth when your app will be installed by other sellers, not just run against your own store — each one authorizes access to their own store, without ever handing you their password or a permanent account-wide API key. If you only need to integrate your own store, an API key is simpler and you can skip this guide.

Flow overview

0. Register your app

First, you need a client_id and client_secret. This is done through the Lojou dashboard (not an API call) — contact support or register your app under Settings → Apps/Integrations to receive credentials and register your allowed redirect_uri(s).

1. Send the seller to authorize

Redirect the seller’s browser to Lojou’s authorization screen, with your app’s client_id and the redirect_uri (must match exactly what was registered in step 0):
The seller logs into their own Lojou account (if not already logged in) and sees a screen with your app’s name and requested scopes, to approve or decline.
Confirm the exact URL for this screen with the Lojou team when you register your app (step 0) — what matters for your integration is the client_id/redirect_uri pair, which the API validates regardless of which page hosts it.

2. Handle the callback

If the seller approves, Lojou redirects back to your redirect_uri with two parameters:
  • code — single-use, expires in 10 minutes.
  • state — the same value Lojou generated for this flow; use it to confirm the response matches an authorization you actually started (CSRF protection).

3. Exchange the code for a token

Store the access_token and refresh_token scoped to that seller (one per connected store) — never to your app as a whole.

4. Call the API on the seller’s behalf

Every /v1/* endpoint works the same whether the token came from OAuth or an API key — the only difference is how the token was issued.

Common errors

Scopes

The seller only approves the scopes your app requested — and may approve a subset of them, depending on what they accept on the authorization screen. The permissions field in the token response tells you exactly what was granted; call GET /v1/scopes at any time to check again.