Identities

Create accounts for the people who build and operate your backend, give them policies, and log them in to the panel and the API.

Identities are accounts for your team: developers, content editors, support staff and operators. They log in to the panel, and their tokens can call every management API their policies allow.

The identities list in the panel's Access Management section

The default identity

Every instance starts with one identity that has full access:

SettingAPI optionDefault
Identifier--passport-default-identity-identifierspica
Password--passport-default-identity-passwordspica
Policies--passport-default-identity-policiesAll *FullAccess policies

Log in

POST/passport/identify
Terminal
curl -X POST https://api.example.com/api/passport/identify \
  -H "Content-Type: application/json" \
  -d '{"identifier": "spica", "password": "spica", "expires": 3600}'
JSON
{"scheme": "IDENTITY", "token": "eyJhbGciOiJIUzI1NiIs...", "issuer": "passport/identity"}
FieldDescription
identifier, passwordCredentials.
expiresOptional token lifetime in seconds, up to the server's limit. See Tokens.

Use the token as Authorization: IDENTITY <token>. The response also sets a refresh token cookie, see Tokens & sessions.

Wrong credentials return 401 with Identifier or password was incorrect. When the identity has two-factor authentication, the response is a challenge instead of a token.

Manage identities

EndpointAction
GET /passport/identitypassport:identity:index
GET /passport/identity/:idpassport:identity:show
POST /passport/identitypassport:identity:create
PUT /passport/identity/:idpassport:identity:update
DELETE /passport/identity/:idpassport:identity:delete
PUT /passport/identity/:id/policy/:policyIdpassport:identity:policy:add
DELETE /passport/identity/:id/policy/:policyIdpassport:identity:policy:remove

Create an identity, then attach policies to it:

Terminal
curl -X POST https://api.example.com/api/passport/identity \
  -H "Authorization: IDENTITY <token>" -H "Content-Type: application/json" \
  -d '{"identifier": "editor", "password": "a-long-random-password"}'

curl -X PUT https://api.example.com/api/passport/identity/<identityId>/policy/BucketFullAccess \
  -H "Authorization: IDENTITY <token>"
JSON
{"identifier": "editor", "policies": [], "_id": "6b0b1b36a5611972c29c2643"}

New identities have no policies. They can log in, but every API call returns 403 until you attach some.

Typical roles

RolePolicies
DeveloperThe *FullAccess policies of the modules they work on.
Content editorA custom policy with the data actions of the content buckets, plus StorageFullAccess for images.
SupportUserReadOnlyAccess, ActivityReadOnlyAccess and read-only data access.
AuditorThe *ReadOnlyAccess policies.

Profile and permissions of the current identity

EndpointReturns
GET /passport/identity/verifyThe decoded token. Send the raw token in Authorization, without the scheme.
GET /passport/identity/statementsEvery policy statement that applies to the caller.

Limits and settings

API optionEffect
--passport-identity-limitMaximum number of identities.
--passport-identity-token-expires-inDefault token lifetime, 2 days.
--passport-identity-token-expiration-seconds-limitLongest lifetime a client can request with expires.
--passport-identity-password-history-limitPrevious passwords that can't be reused.
--passport-identity-failed-login-attempt-limit, --passport-identity-block-duration-after-failed-login-attemptsLockout after failed logins.

Password rules such as minimum length are set in the identity configuration.