Portal Page and Attendee Token Context
Portal authentication identifies an attendee or reader. Page-context authorization decides which installed resources that principal may use. A public page key supplies the second context; it does not identify a learner or grant administrator access.
Choose the transport
| Request | Credential/context | What it establishes |
|---|---|---|
| Guest on a public page | Page key as bearer | Page principal; subject to active/login/audience/dependency checks |
| Attendee app in its portal | Runtime page key plus portal session | Attendee identity and installed page context |
| Attendee bearer integration | Attendee token as bearer, page key in X-Portal-Page-Token | Individual attendee and page context; endpoint must support this principal |
| Reader accessing a page | Supported reader session/token plus page context | Active reader from the page's project, evaluated as a guest for attendee group rules |
Use the GxP Store inside plugins. It supplies the installed context consistently. Do not embed a privileged project key to make a failing page request work.
On the portal API, the page must belong to the portal serving the hostname. On supported API-host data routes, page context can also be resolved from the header or a page bearer; it must belong to the requested project. Form/quiz/survey page-context routes remain portal-only. A mismatched bearer page and header page are rejected, not combined.
Obtain the method ID and page key
An external integrator needs the configured portal and installed page, not a key copied from an unrelated preview. Have the project administrator confirm the serving domain, portal, active page, its installed resource/dependency bindings and intended audience.
For a plugin-backed page that publishes the current portal bootstrap, inspect its initial HTML/Inertia data-page JSON:
props.pluginData.apiPageAuthIdis that installed page's public key. Keep the complete value. It is distinct from a Developer Hub Project API Key.props.pluginData.projectIdidentifies the team/project slugs;props.portal.ididentifies the serving portal. Compare them with the intended admin configuration. For a form page, also confirm its form binding rather than reusing another page's key.props.portal.portalAuthenticationMethodslists the available configured login methods. Use the selected method'sidasmethod_id; the method key identifies its type. For the email/password example below, select that active method, not an OTP or reader method.
An authorized administrator can also inspect the portal's Authentication controls and their JSON listing at /p/{team}/{project}/portals/{portal}/authentication-methods through the dashboard's normal AJAX/session transport. This is an admin route, not a public REST discovery endpoint. If the page does not publish this bootstrap or access is unavailable, obtain the intended page configuration from its administrator; do not substitute a privileged key or invent a universal method ID. Use the serving portal's origin for portal-bound operations even when a plugin's general API base points elsewhere.
Configure attendee bearer authentication
- Configure an active attendee authentication method on the portal. Use its configured portal-method ID, not the method name or a universal ID.
- Enable the portal's token-auth setting,
auth_settings.enable_token_auth. - Configure the intended attendee type and audience restrictions. Automatic registration is method-dependent; enabling
create_new_on_missingdoes not guarantee every missing identity can be created or admitted. - Set the desired token duration. The issuance fallback is
token_duration, thensession_timeout, then 1440 minutes. - Use the serving portal's credential flow, keep each attendee's token separate, and verify the specific endpoint before rollout.
The existing JSON exchange is POST /auth/token on the serving portal. For an enabled email/password method, its body is:
{
"method_id": 42,
"email": "participant@example.test",
"password": "REPLACE_WITH_PARTICIPANT_PASSWORD"
}
These are placeholder credentials. Successful issuance returns token, expires_at, attendee (id, uuid) and portal (id). The token has the portal ability portal:{id}. Reuse it for that attendee's supported API operations; a token for one principal is not a shared anonymous quiz identity.
GET /api/v1/projects/TEAM_SLUG/PROJECT_SLUG/attendees
Authorization: Bearer ATTENDEE_TOKEN
X-Portal-Page-Token: PAGE_KEY
Accept: application/json
The page still needs the requested resource/action dependency and audience access. This example demonstrates header placement, not a grant to view the whole attendee list.
Web login, OTP and cross-origin callers
The portal login page is /log-in. Web login methods use their configured handlers, including /auth/login, /one-time-password/request and /one-time-password/login. Web OTP produces the established portal login/session flow; do not treat those routes as a stateless question/answer API.
/auth/token is excluded from CSRF verification, but the current CORS configuration covers API/spec paths and does not list /auth/token. A same-origin exchange working in the portal does not prove an external browser can call it. Verify the deployed origin/header policy and the method's credential contract; retain CSRF/session handling for other web routes.
The documentation-specific bank/OTP/native-attempt adapter is a prepared platform update. It resolves the external docs use case without sharing a reader credential or silently recording unscored form responses. Existing quiz endpoints may use portal session identity rather than accepting every attendee bearer; test the released endpoint, not just token issuance.
Logout and lifecycle
DELETE /auth/token on the serving portal requires the attendee bearer and its matching portal ability, then deletes that current token. It does not revoke all attendee tokens or end every browser session. Normal web logout is a separate session flow.
A copied page key must still pass active page, required login and audience checks. Disabling a page or changing its audience is meaningful even when a key remains known. Do not assume page keys share project-token expiry or treat them as proof of attendee identity.
Acceptance and troubleshooting
Verify a public guest page, a login-only page, same-project attendee access, another-project identity, excluded/overlapping groups, an inactive page and conflicting page keys. Check actual list/record/field output as well as navigation. Cover expiry, token logout, wrong portal and an unavailable form binding. A successful login or hidden menu item is not the authorization test.
401 can mean a missing attendee or unsatisfied page login. Audience/inactive/wrong-context resources can return 404. Token issuance returns 403 when token auth is disabled; invalid credentials/configuration have their own JSON errors. Browser-only failures call for CORS/session/CSRF diagnosis rather than broader resource permissions.
Implementation evidence
Reviewed against experience-portal 04c7d10048 on 2026-10-13: routes/portal/app.php, TokenAuthController, AttendeeEmailPasswordLoginMethod, BaseLoginMethod, PortalApiConfig, PortalPageTokenResolver, PortalPageAccess, ResolvePermissionContext, EnforcePermissionContext, FormPageAccess, VerifyCsrfToken and config/cors.php. Bootstrap/admin discovery was checked against b9cd4c4ce9: PluginPageRenderService, PortalConfig, PortalInertiaRequests, ProjectPortalService, PortalAuthenticationMethodController and dashboard routes. Deployed cross-origin/credential acceptance remains separate.