> ## Documentation Index
> Fetch the complete documentation index at: https://polaris.nimonic.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# 인증 토큰 발급

> 
<p>Kakao 로그인 후 발급된 코드로 로그인할 수 있는 액세스 토큰 및 리프레시 토큰을 발급합니다.</p>
<p>액세스 토큰은 메모리에 저장 후 Authorization 헤더에 담아 전송해야 합니다.</p>
<p>리프레시 토큰은 쿠키나 Keychain, Keystore에 저장하고 <code>/api/v1/auth/refresh</code>로 요청할 때만 전송하도록 해야 합니다.</p>
<p>액세스 토큰은 10분(600초), 리프레시 토큰은 1년(31536000초) 간 유효합니다.</p>




## OpenAPI

````yaml /api-docs.json post /api/v1/auth/exchange
openapi: 3.1.0
info:
  title: Polaris API
  version: 0.0.1
servers:
  - url: https://k-polaris.life
    description: Polaris API 서버
security: []
paths:
  /api/v1/auth/exchange:
    post:
      tags:
        - 인증
      summary: 인증 토큰 발급
      description: >

        <p>Kakao 로그인 후 발급된 코드로 로그인할 수 있는 액세스 토큰 및 리프레시 토큰을 발급합니다.</p>

        <p>액세스 토큰은 메모리에 저장 후 Authorization 헤더에 담아 전송해야 합니다.</p>

        <p>리프레시 토큰은 쿠키나 Keychain, Keystore에 저장하고
        <code>/api/v1/auth/refresh</code>로 요청할 때만 전송하도록 해야 합니다.</p>

        <p>액세스 토큰은 10분(600초), 리프레시 토큰은 1년(31536000초) 간 유효합니다.</p>
      operationId: exchange
      requestBody:
        content:
          application/json;charset=UTF-8:
            schema:
              $ref: '#/components/schemas/ExchangeCodeRequest'
        required: true
      responses:
        '200':
          description: OK
          content:
            application/json;charset=UTF-8:
              schema:
                $ref: '#/components/schemas/AuthTokenResponse'
components:
  schemas:
    ExchangeCodeRequest:
      type: object
      properties:
        code:
          type: string
          minLength: 1
        targetId:
          type: string
          minLength: 1
        codeVerifier:
          type: string
      required:
        - code
        - targetId
    AuthTokenResponse:
      type: object
      properties:
        accessToken:
          type: string
        refreshToken:
          type: string
        expiresIn:
          type: integer
          format: int64
        userId:
          type: integer
          format: int64

````