Authorize
OAuth
Authorize
Start the OAuth 2.0 authorization code flow for a merchant
GET
Authorize
Documentation Index
Fetch the complete documentation index at: https://docs.launchmystore.io/llms.txt
Use this file to discover all available pages before exploring further.
Authorize
Starts the OAuth 2.0 authorization code grant flow. The merchant must be signed in to their LaunchMyStore admin when this endpoint is hit — the endpoint is protected by merchant auth and uses the merchant’s session to resolve whichstoreId is granting consent. On success, the endpoint
returns a one-time code plus an opaque state your app must round-trip
to POST /apps/oauth/token to exchange for an access token.
The
state parameter returned by this endpoint is server-generated
and bound to the authorization code in Redis with a 10-minute TTL. You
must echo it back on the token exchange call. Your own anti-CSRF token,
if any, should be passed in the request as a separate value and is not
read by the server.Request
Query Parameters
The app’s public client identifier. Issued when the developer registers
the app via
POST /apps/developer/create.The callback URL where the merchant will be redirected after consent.
Must exactly match one of the URLs in
app.redirectUrls. Mismatched URIs
return 400 Invalid redirect URI.Comma-separated list of scopes being requested (e.g.
read_products,write_orders). Each scope must be a member of the app’s
registered scope set; otherwise the endpoint returns
400 Invalid scopes: <list>. See Scopes
for the 37 available scopes.Must be
code. Any other value returns
400 Unsupported response_type. Defaults to code when omitted for
back-compat.Optional client-side anti-CSRF nonce. The server stores this in
clientState and returns it untouched alongside the server-generated
state for your reference. Not used for server-side validation.PKCE (RFC 7636) code challenge. When supplied, the matching
code_verifier must be sent on the token exchange. Length must be
43-128 characters.Either
S256 (strongly recommended) or plain. Any other value
returns 400. Only meaningful when code_challenge is also sent.Response
HTTP status code (200 on success).
Final response state:
"success" or "error".Example Response
redirect_uri with
code and state appended as query parameters, then immediately call
POST /apps/oauth/token server-side.
PKCE Flow (recommended for public clients)
Error Codes
| HTTP | Error message | When |
|---|---|---|
400 | Invalid redirect URI | redirect_uri not in app.redirectUrls |
400 | Invalid scopes: <names> | One or more requested scopes not registered on the app |
400 | Unsupported response_type | response_type is anything other than code |
400 | Invalid code_challenge_method | Not S256 or plain |
400 | code_challenge must be 43-128 characters | PKCE challenge length out of range |
401 | (auth guard) | No valid merchant session on the request |
404 | App not found or not published | client_id does not match a published app |
Security Notes
- Authorization codes are stored in Redis with a 10-minute TTL and are
single-use. Replays of an already-consumed code fail with
Invalid or expired authorization codeon the token endpoint. - The server-generated
stateis bound to thecodein Redis. Both are deleted atomically when the token is issued. - This endpoint is not rate-limited at the gateway (
@SkipThrottle) — it is already gated by merchant authentication. - For embedded apps, prefer PKCE + session tokens. See Session Tokens.