Skip to main content
Your backend has one Amika API key with the end-users:act-as permission. This page calls it the act-as key. Keep the act-as key on your backend. Do not send it to your users. Your backend can use the act-as key in two ways: To set up your backend and create rigs for your users, see End-user access.

Act as an end-user with the Amika-As-Principal header

Your backend sends two things on each HTTP API request:
  • The act-as key, in the Authorization header.
  • The header Amika-As-Principal: end_user:<your user id>.
Amika does the request as that end-user. The end-user gets no credential. In the SDK, actAs returns a new client. The new client acts as the end-user:
Rules:
  • Without the Amika-As-Principal header, the act-as key gets 403 on all routes except three: mint a token, revoke a token, and disable an end-user.
  • The act-as key cannot act as your organization.
  • After you disable an end-user, a request that acts as them gets 403.

Give the end-user a principal token

Your backend mints a principal token for one end-user. The end-user’s machine and laptop send this token to Amika. The act-as key stays on your backend. In the SDK:
Rules:
  • A principal token acts as one end-user. It cannot mint a token.
  • A principal token expires after its TTL. The maximum TTL is 24 hours. Mint a new token before the old one expires. In an app, refreshingTokenSource in the SDK does this for you.
  • When you disable an end-user, all of their tokens stop working at once.