Who is calling the API: a key (with its owner and effective scopes), a person's live
browser session or linked Telegram chat (in process,
PhoenixKit.API.Executor.execute_as/5) or an anonymous public caller.
kind-:keyfor a verified bearer key,:userfor a live session or a linked Telegram chat,:anonymousfor a public caller.source- the channel a:useracts through:"telegram"for a linked Telegram chat,nilfor a live session (and for every other kind).key_uuid,key_prefix- the key, when there is one (nilfor:user).user_uuid- the key's owner, or the session's (or linked chat's) user.scopes- the key's effective scopes (its own, filtered by the owner's live permissions), or the scopes the session's scope holds (PhoenixKit.API.Keys.held_scopes_of/1).scope- thePhoenixKit.Users.Auth.Scopethose scopes were computed from: the owner'sScope.for_user(owner, narrow: false)for a key, the session's narrowed scope for:user(the user's default role's, for a linked chat too),nilfor an anonymous caller. Handlers read it asctx.scope.personal- the key is a personal one (PhoenixKit.API.Keys.Key'spersonal): its owner's right to personal keys was checked when the actor was built.PhoenixKit.API.Keys.effective_scopes/1checks it again for an old actor.falsefor every other actor.requires_approval- every write call of the key (not a read, not adry_run) waits for a human, dangerous or not.client_token_hash- the hash of the client token an anonymous public caller sent in the field its tool declares (PhoenixKit.API.Tool's:client_token);nilwhen the tool declares none or the caller sent none. The raw token is never kept.ip- the address the request came from, as a string.
The default is the least-privileged value: anonymous, no scopes, not personal, no approval.
inspect/1 leaves scope out: it holds the user (email, name), and the actor sits in
conn.assigns on every API request, where error reports and debug pages print it.
Summary
Types
@type t() :: %PhoenixKit.API.Actor{ client_token_hash: String.t() | nil, ip: String.t() | nil, key_prefix: String.t() | nil, key_uuid: String.t() | nil, kind: :key | :user | :anonymous, personal: boolean(), requires_approval: boolean(), scope: PhoenixKit.Users.Auth.Scope.t() | nil, scopes: [String.t()], source: String.t() | nil, user_uuid: String.t() | nil }