Auth guard: bearer JWT minted for a platform service account (actor_type: platform_service). The handler calls actor.require_platform_service(), so only a platform service-account token is admitted — admins, dashboard users, and end-user tokens are rejected. The platform_id is taken from the token claim, never from the request body.

Overview

Aarokya does not own user authentication — that belongs to the partner app (e.g. Namma Yatri). The partner backend authenticates as its platform service account, then calls POST /auth/token with a verified phone number and id-proof and receives a short-lived app JWT scoped to that user. This is the only token-issuance endpoint, and the app JWT is stateless and self-contained. The platform service-account bearer is obtained out-of-band: an admin provisions a credential via POST /platforms/{platform_id}/credentials, which returns a basic_token. The platform exchanges that basic_token with Keycloak (client_credentials grant) for the service-account JWT it presents here. See the Platform module for credential provisioning.

Token Issuance Flow


Find-or-Create Semantics

Lookup is by (phone_country_code, phone_number) against active users — it is not keyed on platform_id. The platform_id from the token is validated and embedded in the issued app token’s claims.

App JWT Claims

The issued access_token is an RS256 app token. Its claims flatten an app actor block alongside standard iss / aud / iat / exp:

Endpoints

POST /auth/token

Issue an app JWT for a user. Creates the user on first call. Requires a platform service-account bearer token.

Request / Response Example

proof_type accepts AADHAAR, PAN, PASSPORT, DRIVING_LICENSE, or VOTER_ID.

Error Codes