Skip to main content

Protect partner keys

Partner keys authorize project-wide operations. Store them in a server-side secret manager or encrypted environment variable and inject them only into trusted backend processes.
Never send a partner key to your frontend as configuration, an API response, a query parameter, or a rendered environment variable. Your backend should expose narrow endpoints that authorize the signed-in customer before calling Social media studio.
Use pk_test_ keys while developing and pk_live_ keys only in production. Keep test and live projects separate, rotate keys periodically, and revoke a key immediately if it may have been exposed.

Authorize every customer operation

The SDK authenticates your application, not the customer using your product. Before every SDK call:
  1. Authenticate the customer in your application.
  2. Resolve the customer’s stored Social media studio endUserId on your server.
  3. Verify that requested connection and post IDs belong to that customer.
  4. Call the SDK using those server-resolved IDs.
Never accept an arbitrary endUserId from a browser and pass it through without checking ownership in your database.

Key scopes

Partner keys can be restricted to the capabilities a service needs: Use separate, least-privilege keys for independent services where possible.

Handle SDK errors

Every unsuccessful API request throws SoMePlatformError:
For post creation, retries are safe only when you reuse the same idempotency key. Do not blindly retry other write operations unless your application can confirm their outcome.

Logging

Log request context such as your customer ID, end-user ID, operation, HTTP status, and idempotency key. Do not log full partner keys, webhook secrets, OAuth tokens, presigned upload URLs, or sensitive customer metadata.