Skip to main content
Version: v1 (Current)

Sanctum Tokens

GxP uses Laravel Sanctum for session and bearer authentication. The token's owner and ability data determine its authorization path; “Sanctum token” alone does not describe what an integration can access.

Project integration tokens​

Issue project keys through Developer Hub → API Keys. These are Sanctum personal-access tokens owned by the selected project, with explicit abilities and required expiry. Record/field choices express grant data; the current project-ownership and list/serializer limitations still apply. See Project API Keys for the current issuance/revocation flow and scope grammar.

Do not assume a generic email/password token endpoint or a coarse read ability provides a read-only project integration. The current documented hub path uses project token management, and legacy coarse grants have broad compatibility behavior.

Admin authentication​

Admin dashboard requests use the platform's authenticated admin context. Admin policies evaluate team/project-scoped permissions. For an admin integration, use an explicitly supported credential flow and the deployed API reference; a project token does not become an admin account. Use the supported project integration routes and verify their isolation rather than using a project token as an administrator enumeration credential.

Portal principals​

Attendee apps use the runtime's page context and attendee/session authentication. A page-only bearer is a guest page principal, not an attendee login. An attendee bearer belongs in Authorization, with the page key separately in X-Portal-Page-Token. The page token and current principal must satisfy page access and project checks before dependency actions are authorized. An active access-point principal can satisfy supported page authentication within its own project. Use store helpers to preserve this context.

Plugin tokens​

Plugin API Tokens for CI authorize plugin-specific endpoints. Widget keys lack independent page context for project data authorization. Their Sanctum storage format does not make them interchangeable with project keys or attendee page credentials.

Request format​

curl 'https://YOUR_API_HOST/api/v1/projects/TEAM_SLUG/PROJECT_SLUG/attendees' \
-H "Authorization: Bearer $GXP_API_TOKEN" \
-H 'Accept: application/json'

Use a project token that permits the requested operation. Add the JSON content-type header for JSON request bodies. For browser plugins, use the platform runtime instead of copying a server key into source.

Expiry and errors​

Project keys have the chosen 15/30/90/180/365-day expiry. Revoked project keys are expired while retaining their history record. Other principal-specific credentials have their own lifecycle, so do not assume all Sanctum credentials have the same expiry.

A 401 calls for an authentication/context check; a 403 calls for an action/scope check; a 404 can protect an inaccessible page or resource. See Permissions and dependencies for runtime authorization and Development Troubleshooting for diagnosis.

Token lifetime by principal​

Project keys use the required selected expiry. Individual attendee tokens from /auth/token use auth_settings.token_duration, then session_timeout, then 1440 minutes; issuance requires portal token auth to be enabled. Reader tokens use their configured expiration days (default seven). Plugin tokens also require an active, unexpired plugin-token record and permitted mappings. Page keys have their own lifecycle and must continue to pass active/login/audience checks; do not assign them the project-key expiry contract.

DELETE /auth/token on the serving portal deletes the current attendee token after validating its portal ability. It does not revoke all tokens or log out every session. Reader tokens are not attendee tokens and cannot complete attendee-only quizzes. See Portal token context for transport and CORS limits.

Implementation evidence​

Reviewed against experience-portal 04c7d10048 on 2026-10-13: config/auth.php, config/sanctum.php, Kernel, TokenAuthController, AccessPointReader, PortalPageTokenResolver, PortalPageAccess and EnsurePluginApiToken. Route-specific acceptance remains required.