---
updatedAt: 2026-04-22T09:48:12.000Z
agentTools:
  projectIndex: https://developers.modusign.co.kr/llms.txt
---

# 토큰 발급 및 재발급

발급받은 인증코드(Docs - OAuth2 연동하기 - 인가요청 참고)를 이용하여 access_token과 refresh_token을 발급받습니다.

토큰 발급과 재발급은 요청 시 아래와 같은 차이가 있으니 유의하시기 바랍니다.

* 토큰 발급 : grant_type="authorization_code", code속성에 인증코드를 입력
* 토큰 재발급 : grant_type="refresh_token", refresh_token속성에 refresh_token을 입력 후 요청

토큰 재발급 시 refresh_token이 함께 갱신되어 발급될 수 있으니 발급 시 기존 발급받은 refresh_token과 상이할 경우 보관중인 저장소의 refresh_token을 함께 갱신해야 합니다.

# OpenAPI definition

```json
{
  "openapi": "3.0.0",
  "paths": {
    "/oauth/token": {
      "post": {
        "description": "발급받은 인증코드(Docs - OAuth2 연동하기 - 인가요청 참고)를 이용하여 access_token과 refresh_token을 발급받습니다.\n\n토큰 발급과 재발급은 요청 시 아래와 같은 차이가 있으니 유의하시기 바랍니다.\n\n* 토큰 발급 : grant_type=\"authorization_code\", code속성에 인증코드를 입력\n* 토큰 재발급 : grant_type=\"refresh_token\", refresh_token속성에 refresh_token을 입력 후 요청\n\n토큰 재발급 시 refresh_token이 함께 갱신되어 발급될 수 있으니 발급 시 기존 발급받은 refresh_token과 상이할 경우 보관중인 저장소의 refresh_token을 함께 갱신해야 합니다.",
        "operationId": "OAuthController_createOAuthToken",
        "parameters": [],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateOAuthTokenRequestDto"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CreateOAuthTokenResponseDto"
                }
              }
            }
          },
          "400": {
            "description": "요청 형식 오류 또는 유효하지 않은 인가 정보(인가 코드·refresh_token·code_verifier)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OAuthErrorResponseDto"
                }
              }
            }
          },
          "401": {
            "description": "클라이언트 인증 실패",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OAuthErrorResponseDto"
                }
              }
            }
          },
          "500": {
            "description": "발급을 처리하지 못함",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OAuthErrorResponseDto"
                }
              }
            }
          },
          "503": {
            "description": "발급을 일시적으로 처리하지 못함",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OAuthErrorResponseDto"
                }
              }
            }
          }
        },
        "summary": "토큰 발급 및 재발급",
        "tags": [
          "OAUTH APPLICATION API"
        ]
      }
    }
  },
  "info": {
    "title": "MODUSIGN API",
    "description": "",
    "version": "1.0.0",
    "contact": {}
  },
  "servers": [
    {
      "url": "https://api.modusign.co.kr",
      "description": "production"
    }
  ],
  "components": {
    "schemas": {
      "CreateOAuthTokenRequestDto": {
        "type": "object",
        "properties": {
          "grant_type": {
            "type": "string",
            "enum": [
              "authorization_code",
              "refresh_token"
            ],
            "description": "토큰 발급 승인 유형"
          },
          "client_id": {
            "type": "string",
            "description": "등록 된 앱의 client_id"
          },
          "client_secret": {
            "type": "string",
            "description": "앱 등록 시 발급받은 client_secret. client_secret을 발급받은 앱은 반드시 전달하고, client_secret 없이 code_challenge(PKCE)로 인가를 요청한 앱은 생략합니다."
          },
          "redirect_uri": {
            "type": "string",
            "nullable": true,
            "description": "인가코드 발급 시 요청 했던 redirect_uri 값(일치 여부 검증), 토큰 재발급시에는 검증하지 않음"
          },
          "code": {
            "type": "string",
            "nullable": true,
            "description": "grant_type이 authorization_code인 경우에만 입력(발급받은 인증코드 입력)"
          },
          "refresh_token": {
            "type": "string",
            "nullable": true,
            "description": "grant_type이 refresh_token인 경우에만 입력(발급받은 refresh_token입력)"
          },
          "code_verifier": {
            "type": "string",
            "description": "PKCE 검증 값(RFC 7636). 인가 요청에 code_challenge를 전달한 경우 필수입니다."
          },
          "resource": {
            "type": "string",
            "description": "RFC 8707 resource 파라미터. 전달하면 발급되는 토큰의 사용 대상이 해당 리소스로 제한됩니다."
          }
        },
        "required": [
          "grant_type",
          "client_id"
        ]
      },
      "CreateOAuthTokenResponseDto": {
        "type": "object",
        "properties": {
          "access_token": {
            "type": "string",
            "description": "발급 받은 access_token"
          },
          "refresh_token": {
            "type": "string",
            "description": "발급 받은 refresh_token(refresh_token은 자동 갱신 될 수 있으니 항상 안전한 곳에 저장 및 갱신 하셔야 합니다.)"
          },
          "token_type": {
            "type": "string",
            "enum": [
              "Bearer"
            ],
            "description": "발급받은 토큰의 타입"
          },
          "expires_in": {
            "type": "number",
            "description": "발급받은 액세스 토큰의 유효 기간(sec.)"
          },
          "refresh_token_expires_in": {
            "type": "number",
            "description": "발급받은 새로고침 토큰의 유효 기간(sec.)"
          },
          "scope": {
            "type": "string",
            "description": "실제로 부여된 접근 범위(공백 구분). 요청한 범위와 다르게 부여될 수 있으니 이 값을 기준으로 사용해야 합니다."
          }
        },
        "required": [
          "access_token",
          "refresh_token",
          "token_type",
          "expires_in",
          "refresh_token_expires_in",
          "scope"
        ]
      },
      "OAuthErrorResponseDto": {
        "type": "object",
        "properties": {
          "type": {
            "type": "string",
            "description": "오류를 낸 예외의 이름"
          },
          "title": {
            "type": "string",
            "description": "오류를 요약한 문구"
          },
          "instance": {
            "type": "string",
            "description": "오류가 발생한 요청 경로"
          },
          "error": {
            "type": "string",
            "description": "규격이 정한 오류 코드. 클라이언트는 이 값으로 실패 사유를 구분합니다."
          },
          "error_description": {
            "type": "string",
            "description": "개발자가 읽을 수 있는 실패 사유"
          },
          "detail": {
            "type": "string",
            "description": "실패에 대한 부가 설명"
          },
          "data": {
            "type": "object",
            "description": "규격 필드로 옮기지 못한 판정 근거. 요청 검증에 실패한 400 에만 담깁니다."
          }
        },
        "required": [
          "type",
          "title",
          "instance",
          "error",
          "error_description"
        ]
      }
    }
  }
}
```