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.- User enters their API key in the settings form
- Platform calls
saveMiniAppCredentialsmutation - If
get_tokenis defined, it’s executed to exchange/validate credentials - Tokens and secrets are stored in
InstalledMiniApps.credentials - If
userDetailsis defined, mapped store/account fields are stored inInstalledMiniApps.metadata - Status set to
connected
HTTP Basic Auth
Use when the provider expectsAuthorization: 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).
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.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. ShopifyX-Shopify-Access-Token, TikTok Access-Token):
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 onInstalledMiniApps:
[[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.).Token Refresh
Whenauto_refresh: true is set and any action request returns a 401 response:
- Platform automatically calls the
refresh_tokenrequest - New credentials are extracted via the mapping
- Credentials are updated in the database
- The original failed request is retried with the new token
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
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.