Authentication and access
SubHero has separate console, server and device authentication. Use the credential appropriate to the caller.
| Caller | Credential | Scope |
|---|---|---|
| Console | Google sign-in session cookie | Company membership and project role |
| Trusted backend | Secret project API key in Authorization: Bearer … | Only that project |
| Mobile bootstrap | pk_live_ or pk_test_ publishable key | Challenge and session issuance |
| Mobile requests | Short-lived SDK session bearer token | One server-issued subject and environment |
| MCP client | Read-only OAuth grant with PKCE | User-approved company/projects |
Mobile identity
Get a challenge, sign it with the installation's P-256 key and exchange it for a session. The companion stores the key in platform secure storage. An optional backend-signed identity JWT links an anonymous subject to an authenticated account. Do not treat a user-supplied string as identity proof.
POST /v1/sdk/signing-secret rotates the server-side HS256 identity secret; it is not a read-only configuration request. Keep it off devices. Previous secrets have a 24-hour overlap. Session logout revokes the current token, and each account switch refreshes the subject before accepting new access data.
Entitlement mapping
Map each product ID to one or more access keys, such as premium. Configure one-time product kinds explicitly when the store does not provide enough information. Grace access follows project policy; refunds and revocations remove access. Unknown mappings surface an alert rather than inventing a grant.
Request outcomes
A 401 requires reauthentication. A 403 means this credential cannot perform the operation. A 409 ownership conflict needs resolution and must not be acknowledged as a successfully bound purchase. Retry temporary failures with backoff and honor Retry-After on 429.
API reference · iOS · Android