Skip to main content

actor_for_api_token

Function actor_for_api_token 

Source
pub async fn actor_for_api_token(
    pool: &PgPool,
    token: &str,
) -> AppResult<Option<(Actor, TokenScope)>>
Expand description

The user of a personal access token and the token’s scope; None for an unknown, expired or revoked token or a deactivated user. A use moves the expiry of a token with a sliding lifetime (idle_days) forward.

Every API and MCP request comes through here, so it is one query: the user, whether the use has to be recorded and the groups that switched personal access tokens off are read in the same statement. The write follows only when it is due.