Skip to main content
The auth object tells the platform how users connect their accounts with your service. auth.type controls the install UX (bearer_token / apikey form vs oauth2 popup). How credentials are sent on each HTTP call is declared in request headers (Bearer, Basic, custom headers, or query params).

Bearer Token (API Key)

The simplest auth method. The user pastes their API key into a form, and the platform stores it securely.
How it works:
  1. User enters their API key in the settings form
  2. Platform calls saveMiniAppCredentials mutation
  3. If get_token is defined, it’s executed to exchange/validate credentials
  4. Tokens and secrets are stored in InstalledMiniApps.credentials
  5. If userDetails is defined, mapped store/account fields are stored in InstalledMiniApps.metadata
  6. Status set to connected

HTTP Basic Auth

Use when the provider expects Authorization: Basic <base64(username:password)> — common for WooCommerce (Consumer Key + Consumer Secret), payment gateways (e.g. Moyasar), and some legacy APIs. Declare the header with a literal colon between the two credential placeholders. The runtime Base64-encodes user:pass automatically after placeholder resolution (Base64 never contains :, so already-encoded values are left alone).
Use the same header on every action / source / sync request:
Deploy note — Basic auto-encoding runs in miniAppsReplaceVariablesInObject for any Authorization header. Deploy plugin-miniapps-api with that helper before shipping WooCommerce-style seeds; otherwise the raw key:secret string is sent and providers return 401.
WooCommerce tip: Prefer HTTPS + Basic. If a host strips the Authorization header, fall back to query params (consumer_key / consumer_secret) on that request — see the WooCommerce seed.

Custom header tokens

Some providers use a dedicated header instead of Bearer/Basic (e.g. Shopify X-Shopify-Access-Token, TikTok Access-Token):
Install UX is still auth.type: 'apikey' (or bearer_token) with a form for the token + any store domain fields.

Per-tenant install storage

Each installed miniapp persists three server-side bags on InstalledMiniApps: [[key]] resolves from credentials first, then metadata (credentials win on key collision). Use camelCase keys in mappings (e.g. storeId) even when the HTTP header name differs (Store-Id: '[[storeId]]').

OAuth 2.0

For services that require OAuth 2.0 authorization (Salla, Google, etc.).
OAuth 2.0 Flow:

Token Refresh

When auto_refresh: true is set and any action request returns a 401 response:
  1. Platform automatically calls the refresh_token request
  2. New credentials are extracted via the mapping
  3. Credentials are updated in the database
  4. The original failed request is retried with the new token
This is handled transparently — no user interaction required.

Registration Requests (Post-Auth Setup)

Registration requests are API calls executed once right after a user successfully authenticates. Use them to:
  • Register webhooks with the provider
  • Fetch initial configuration (store ID, workspace info)
  • Subscribe to events
Available placeholders in registration requests:
Object mappings in registrationRequests are persisted to credentials. userDetails mappings are persisted to metadata in full. Both bags are available for [[key]] placeholders in sync headers, actions, and automations.
Last modified on August 8, 2026