> ## Documentation Index
> Fetch the complete documentation index at: https://docs.golfjoin.co.kr/llms.txt
> Use this file to discover all available pages before exploring further.

# 토큰 발급·갱신

> 인가 코드로 처음 토큰을 받거나(`grant_type=authorization_code`), refresh token으로 새 토큰을 받습니다(`grant_type=refresh_token`).
갱신하면 access token과 refresh token이 모두 새로 발급되고, 이전 두 토큰은 바로 무효가 됩니다. 이미 쓴 refresh token이 다시 들어오면 그 매니저의 연결을 모두 끊습니다.




## OpenAPI

````yaml /api-reference/openapi.yaml post /api/v1/oauth/token
openapi: 3.1.0
info:
  title: 조인성공 파트너 API
  version: '2026-11-02'
  description: 매니저 본인의 권한으로 조인성공 티 매물을 등록·수정·마감합니다.
servers:
  - url: https://golfjoin.co.kr
security:
  - bearerAuth: []
paths:
  /api/v1/oauth/token:
    post:
      tags:
        - 인증
      summary: 토큰 발급·갱신
      description: >
        인가 코드로 처음 토큰을 받거나(`grant_type=authorization_code`), refresh token으로 새
        토큰을 받습니다(`grant_type=refresh_token`).

        갱신하면 access token과 refresh token이 모두 새로 발급되고, 이전 두 토큰은 바로 무효가 됩니다. 이미 쓴
        refresh token이 다시 들어오면 그 매니저의 연결을 모두 끊습니다.
      requestBody:
        required: true
        content:
          application/x-www-form-urlencoded:
            schema:
              type: object
              required:
                - grant_type
                - client_id
              properties:
                grant_type:
                  type: string
                  enum:
                    - authorization_code
                    - refresh_token
                client_id:
                  type: string
                  description: 발급받은 클라이언트 ID
                  example: your-client-id
                code:
                  type: string
                  description: 'authorization_code: 로그인 후 돌아온 code (5분, 1회)'
                redirect_uri:
                  type: string
                  description: 'authorization_code: 로그인 주소에 넣은 값과 같은 주소'
                  example: http://127.0.0.1:53682/callback
                code_verifier:
                  type: string
                  description: 'authorization_code: PKCE 원래 값'
                refresh_token:
                  type: string
                  description: 'refresh_token: 마지막으로 받은 refresh token'
      responses:
        '200':
          description: 발급 성공
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/TokenResponse'
        '400':
          description: invalid_request, unsupported_grant_type, invalid_grant
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              example:
                error: invalid_grant
      security: []
components:
  schemas:
    TokenResponse:
      type: object
      required:
        - access_token
        - token_type
        - expires_in
      properties:
        access_token:
          type: string
          description: API 호출에 쓰는 토큰
        token_type:
          type: string
          enum:
            - Bearer
        expires_in:
          type: integer
          description: access token 유효 시간(초)
          example: 3600
        refresh_token:
          type: string
          description: 토큰 갱신용. 갱신할 때마다 새 값으로 바뀝니다.
        refresh_expires_in:
          type: integer
          description: refresh token 유효 시간(초)
          example: 5184000
    Error:
      type: object
      required:
        - error
      properties:
        error:
          type: string
          description: 오류 코드
          example: invalid_input
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      description: OAuth 로그인으로 받은 access token. 1시간 동안 유효합니다.

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.