> ## Documentation Index
> Fetch the complete documentation index at: https://humanity-eaeda8f6.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# OAuth · Authorize

<Callout>
  **SDK equivalent**

  ```ts theme={null}
  const { url, codeVerifier } = sdk.buildAuthUrl({
    scopes: ['is_human', 'humanity_user'],
    state: crypto.randomUUID(),
  });
  ```
</Callout>

Kick off the OAuth 2.1 + PKCE handshake. Build URLs with `HumanitySDK.buildAuthUrl` or construct them manually with:

* `client_id`, `redirect_uri`, `response_type=code`
* `scope` – space-delimited preset keys (e.g. `is_human is_21_plus`)
* `code_challenge` + `code_challenge_method=S256`
* Optional context: `state`, `prompt`, `nonce`, `authorization_id`, `login_hint`

Use `/oauth/authorize/context` to hydrate an authorization prompt (name, avatar, requested presets) and `/oauth/authorize/result` to resolve the final decision if you are embedding the consent UI.


## OpenAPI

````yaml api-reference/openapi.json get /oauth/authorize
openapi: 3.1.0
info:
  version: 0.1.0
  title: hp-public-dev-api-server
  description: NestJS CQRS + TDD base for Humanity Public Dev API
servers:
  - url: https://api.sandbox.humanity.org/v2
    description: Sandbox environment for development and testing
  - url: https://api.humanity.org/v2
    description: Production environment
security: []
tags: []
paths:
  /oauth/authorize:
    get:
      tags: []
      parameters:
        - name: client_id
          in: query
          schema:
            type: string
          required: true
        - name: redirect_uri
          in: query
          schema:
            type: string
          required: true
        - name: response_type
          in: query
          schema:
            const: code
          required: true
        - name: scope
          in: query
          schema:
            type: string
          required: true
        - name: state
          in: query
          schema:
            type: string
          required: false
        - name: code_challenge
          in: query
          schema:
            type: string
          required: true
        - name: code_challenge_method
          in: query
          schema:
            const: S256
          required: true
        - name: authorization_id
          in: query
          schema:
            type: string
          required: false
        - name: login_hint
          in: query
          schema:
            type: string
          required: false
        - name: locale
          in: query
          schema:
            type: string
          required: false
        - name: nonce
          in: query
          schema:
            type: string
          required: false
      responses:
        '200':
          description: ''
          content:
            application/json: {}

````