Check Credential Status

​

Verify the credential is valid and describe it: the acting user, the credential (session or API key), and the grants enforcement will apply.

credential is null only when the auth middleware left neither a session id nor an API key id on the request, which no supported auth path does — unifiedAuth always sets one. credential and grants are both present on every supported auth path, because a session and an API key each carry an id. The controller's fallback branch, which answers with authenticated and user alone, is reachable only by a middleware that sets req.user without req.authUser, which no shipped provider does.

Responses

  • application/json
  • application/json
  • application/json
Request Example for get/auth/check
curl https://api.gpcn.com/v1/auth/check \
  --header 'X-API-Key: YOUR_SECRET_TOKEN'
{
  "success": true,
  "data": {
    "authenticated": true,
    "credential": {
      "kind": "session",
      "id": "string",
      "name": "ci-deploy",
      "keyStart": "gpcn_AbCd",
      "entityId": "123e4567-e89b-12d3-a456-426614174000",
      "issuedAt": "2026-10-21T16:19:07.188Z",
      "expiresAt": "2026-10-21T16:19:07.188Z",
      "lastUsedAt": "2026-10-21T16:19:07.188Z",
      "impersonatedBy": "123e4567-e89b-12d3-a456-426614174000"
    },
    "grants": {
      "source": "user_roles",
      "entityId": "123e4567-e89b-12d3-a456-426614174000",
      "roles": [
        {
          "id": "123e4567-e89b-12d3-a456-426614174000",
          "name": "tenant-admin",
          "displayName": "Tenant Admin",
          "scope": {
            "entityId": "123e4567-e89b-12d3-a456-426614174000",
            "resourceGroupId": "123e4567-e89b-12d3-a456-426614174000"
          },
          "permissions": [
            "user:create",
            "vm:read"
          ]
        }
      ],
      "permissions": [
        "user:create",
        "vm:read"
      ]
    },
    "user": {
      "id": "123e4567-e89b-12d3-a456-426614174000",
      "email": "hello@example.com",
      "firstName": "string",
      "lastName": "string",
      "entityIds": [
        "123e4567-e89b-12d3-a456-426614174000"
      ],
      "primaryEntityId": "123e4567-e89b-12d3-a456-426614174000",
      "activeEntityId": "123e4567-e89b-12d3-a456-426614174000",
      "twoFactorEnabled": true,
      "mfaEnabled": true,
      "mfaVerified": true
    }
  }
}