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

# OAuth API 참조 문서 색인

<div id="oauth-10a">
  ### OAuth 1.0a
</div>

|                                                                                                                           |                                                                                                                     |
| :------------------------------------------------------------------------------------------------------------------------ | :------------------------------------------------------------------------------------------------------------------ |
| **Purpose**                                                                                                               | Method                                                                                                              |
| 3-legged OAuth 플로우 및 Sign in with X의 1단계  <br />Consumer 애플리케이션이 사용자 승인을 요청하기 위한 OAuth Request Token을 획득할 수 있도록 합니다.      | [POST oauth/request\_token](/ko/resources/fundamentals/authentication/api-reference#post-oauth-request-token)       |
| 3-legged OAuth 플로우 및 Sign in with X의 2단계  <br />Consumer 애플리케이션이 사용자 승인을 요청하기 위해 OAuth Request Token을 사용할 수 있도록 합니다.      | [GET oauth/authenticate](/ko/resources/fundamentals/authentication/api-reference#get-oauth-authenticate)            |
| 3-legged OAuth 플로우 및 Sign in with X의 2단계  <br />Consumer 애플리케이션이 사용자 승인을 요청하기 위해 OAuth Request Token을 사용할 수 있도록 합니다.      | [GET oauth/authorize](/ko/resources/fundamentals/authentication/api-reference#get-oauth-authorize)                  |
| 3-legged OAuth 플로우 및 Sign in with X의 3단계  <br />Consumer 애플리케이션이 OAuth Request Token을 OAuth Access Token으로 교환할 수 있도록 합니다. | [POST oauth/access\_token](/ko/resources/fundamentals/authentication/api-reference#post-oauth-access-token)         |
| 등록된 애플리케이션이 발급된 OAuth Access Token을 취소(무효화)할 수 있도록 합니다.                                                                   | [POST oauth/invalidate\_token](/ko/resources/fundamentals/authentication/api-reference#post-oauth-invalidate-token) |

<div id="oauth-20-bearer-token">
  ### OAuth 2.0 Bearer 토큰
</div>

|                                                                                                       |                                                                                                                       |
| :---------------------------------------------------------------------------------------------------- | :-------------------------------------------------------------------------------------------------------------------- |
| **목적**                                                                                                | 메서드                                                                                                                   |
| 등록된 App이 OAuth 2 앱 전용 Bearer 토큰을 생성할 수 있게 합니다. 이 토큰은 사용자 컨텍스트 없이 App을 대신하여 API 요청을 수행하는 데 사용할 수 있습니다. | [POST oauth2/token](/ko/resources/fundamentals/authentication/api-reference#post-oauth2-token)                        |
| 등록된 App이 발급된 OAuth 2 앱 전용 Bearer 토큰을 취소(무효화)할 수 있게 합니다.                                               | [POST oauth2/invalidate\_token](/ko/resources/fundamentals/authentication/api-reference#post-oauth2-invalidate-token) |

<div id="post-oauthrequest_token">
  ### POST oauth/request\_token
</div>

Consumer 애플리케이션이 사용자 승인을 요청할 수 있도록 OAuth Request Token을 얻는 메서드입니다. 이 메서드는 [OAuth 1.0 인증 플로우](http://oauth.net/core/1.0/#anchor9)의 [섹션 6.1](https://oauth.net/core/1.0/#auth_step1)을 충족합니다.

**모든 OAuth 인증 단계에서 HTTPS 사용을 필수로 요구합니다.**

**사용 참고 사항:** `oauth_nonce` 에는 ASCII 값만 허용됩니다.

**리소스 URL[](#resource-url "Permalink to this headline")**

`https://api.x.com/oauth/request_token`

**리소스 정보[](#resource-information "Permalink to this headline")**

|               |      |
| :------------ | :--- |
| 응답 형식         | JSON |
| 인증 필요 여부      | 아니요  |
| 요청 수 제한 적용 여부 | 예    |

**매개변수[](#parameters "Permalink to this headline")**

| Name                  | Required | Description                                                                                                                                                                                                                                                                                                                                     | Example                                                          |
| :-------------------- | :------- | :---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | :--------------------------------------------------------------- |
| oauth\_callback       | required | OAuth 1.0a 규격을 준수하기 위해 이 매개변수는 **필수**입니다. 여기서 지정한 값은 사용자가 애플리케이션에 자신의 계정 접근을 승인했을 때 리디렉션되는 URL로 사용됩니다. `oob` 로 설정하면 out-of-band PIN 모드가 됩니다. 이는 데스크톱/모바일 애플리케이션에서 사용할 사용자 정의 콜백을 지정하는 방식이기도 합니다. 사전에 콜백이 등록되어 있더라도 이 단계에서는 항상 `oauth_callback` 을 전송해야 합니다.<br /><br />이 엔드포인트에서 사용하는 모든 callback URL은 developer.x.com의 App 설정에서 반드시 구성되어야 합니다\* | `http://themattharris.local/auth.php` `twitterclient://callback` |
| x\_auth\_access\_type | optional | 애플리케이션이 사용자 계정에 요청하는 액세스 수준을 재정의합니다. 지원되는 값은 `read` 또는 `write` 입니다. 이 매개변수는 개발자가 읽기/쓰기 애플리케이션을 등록했더라도, 상황에 따라 읽기 전용 액세스를 요청할 수 있도록 하기 위한 것입니다.                                                                                                                                                                                                  |                                                                  |

콜백 URL을 승인하는 방법에 대한 자세한 내용은 [이 페이지](/ko/resources/fundamentals/developer-apps#callback-urls)를 참고하세요.

**주의 사항** - developer.x.com에서 X 계정으로 로그인한 상태라면 [X 앱 대시보드](https://developer.x.com/en/apps)를 통해 기존의 [X apps](/ko/resources/fundamentals/developer-apps)를 조회하고 편집할 수 있습니다.

**예제 요청[](#example-request "Permalink to this headline")**

Request URL: `POST https://api.x.com/oauth/request_token`

Request POST Body: *N/A*

Authorization Header: `OAuth oauth_nonce="K7ny27JTpKVsTgdyLdDfmQQWVLERj2zAK5BslRsqyw", oauth_callback="http%3A%2F%2Fmyapp.com%3A3005%2Ftwitter%2Fprocess_callback", oauth_signature_method="HMAC-SHA1", oauth_timestamp="1300228849", oauth_consumer_key="OqEqJeafRSF11jBMStrZz", oauth_signature="Pc%2BMLdv028fxCErFyi8KXFM%2BddU%3D", oauth_version="1.0"`

Response: `oauth_token=Z6eEdO8MOmk394WozF5oKyuAv855l4Mlqo7hhlSLik&oauth_token_secret=Kd75W4OQfb2oJTV0vzGzeXftVAwgMnEK9MumzYcM&oauth_callback_confirmed=true`

<div id="get-oauthauthorize">
  ### GET oauth/authorize
</div>

Consumer 애플리케이션이 OAuth Request Token을 사용하여 사용자 승인을 요청할 수 있도록 합니다. 이 메서드는 [OAuth 1.0 인증 플로우](http://oauth.net/core/1.0/#anchor9)의 [섹션 6.2](http://oauth.net/core/1.0/#auth_step2)에 해당합니다. 데스크톱 애플리케이션은 반드시 이 메서드를 사용해야 하며([GET oauth / authenticate](/ko/resources/fundamentals/authentication/api-reference#get-oauth-authenticate)는 사용할 수 없습니다).

**사용 참고:** `oauth_callback`은 이 메서드로는 절대 전송되지 않으며, 대신 [POST oauth / request\_token](/ko/resources/fundamentals/authentication/api-reference#post-oauth-request-token)에 제공해야 합니다.

**리소스 URL[](#resource-url "이 제목의 퍼머링크")**

`https://api.x.com/oauth/authorize`

**리소스 정보[](#resource-information "이 제목의 퍼머링크")**

|              |      |
| :----------- | :--- |
| 응답 형식        | JSON |
| 인증 필요 여부     | 예    |
| 레이트 리밋 적용 여부 | 예    |

**매개변수[](#parameters "이 제목의 퍼머링크")**

|              |       |                                                 |     |    |
| :----------- | :---- | :---------------------------------------------- | :-- | :- |
| 이름           | 필수 여부 | 설명                                              | 기본값 | 예시 |
| force\_login | 선택 사항 | 올바른 사용자 계정이 승인되도록, 사용자가 자격 증명을 반드시 입력하도록 강제합니다. |     |    |
| screen\_name | 선택 사항 | OAuth 로그인 화면의 사용자 이름 입력란을 지정한 값으로 미리 채웁니다.      |     |    |

**요청 예시[](#example-request "이 제목의 퍼머링크")**

웹 브라우저에서 `oauth/authorize` 단계로 사용자를 보낼 때, `oauth_token` 매개변수를 함께 포함합니다:
`https://api.x.com/oauth/authorize?oauth_token=Z6eEdO8MOmk394WozF5oKyuAv855l4Mlqo7hhlSLik`

<div id="get-oauthauthenticate">
  ### GET oauth/authenticate
</div>

Consumer 애플리케이션이 OAuth `request_token`을 사용하여 사용자 승인을 요청할 수 있도록 합니다.

이 메서드는 콜백 인증 플로우를 사용하는 애플리케이션을 위한 [OAuth 1.0 인증 플로우](http://oauth.net/core/1.0/#anchor9)의 [섹션 6.2](http://oauth.net/core/1.0/#auth_step2)를 대체합니다. `force_login` 매개변수가 `true`로 설정되지 않는 한, 이 메서드는 현재 로그인한 사용자를 액세스 권한 부여용 계정으로 사용합니다.

이 메서드는 사용자가 이미 애플리케이션에 권한을 부여한 경우, 사용자가 애플리케이션을 다시 승인할 필요 없이 리다이렉트가 발생한다는 점에서 [GET oauth / authorize](/ko/resources/fundamentals/authentication/api-reference#get-oauth-authorize)와 다릅니다. 이 동작이 적용되도록 하려면 [application record](https://developer.x.com/apps)에서 *Use Sign in with X* 설정을 활성화해야 합니다.

**Resource URL[](#resource-url "Permalink to this headline")**

`https://api.x.com/oauth/authenticate`

**Resource Information[](#resource-information "Permalink to this headline")**

|                          |      |
| :----------------------- | :--- |
| Response formats         | JSON |
| Requires authentication? | Yes  |
| Rate limited?            | Yes  |

**Parameters[](#parameters "Permalink to this headline")**

|              |          |                                               |               |         |
| :----------- | :------- | :-------------------------------------------- | :------------ | :------ |
| Name         | Required | Description                                   | Default Value | Example |
| force\_login | optional | 올바른 사용자 계정이 승인되도록 사용자가 자격 증명을 다시 입력하도록 강제합니다. |               | *true*  |
| screen\_name | optional | OAuth 로그인 화면의 사용자 이름 입력 상자를 지정된 값으로 미리 채웁니다.  |               |         |

**Example request[](#example-request "Permalink to this headline")**

웹 브라우저에서 oauth\_token 매개변수를 포함하여 사용자를 `oauth/authenticate` 단계로 보냅니다:
`https://api.x.com/oauth/authenticate?oauth_token=Z6eEdO8MOmk394WozF5oKyuAv855l4Mlqo7hhlSLik`

<div id="post-oauthaccess_token">
  ### POST oauth/access\_token
</div>

Consumer 애플리케이션이 OAuth Request Token을 OAuth Access Token으로 교환할 수 있도록 합니다. 이 메서드는 [OAuth 1.0 인증 플로우](http://oauth.net/core/1.0/#anchor9)의 [섹션 6.3](http://oauth.net/core/1.0/#auth_step3)에 해당합니다.

**Resource URL[](#resource-url "이 제목의 퍼머링크")**

`https://api.x.com/oauth/access_token`

**Resource Information[](#resource-information "이 제목의 퍼머링크")**

|                          |      |
| :----------------------- | :--- |
| Response formats         | JSON |
| Requires authentication? | Yes  |
| Rate limited?            | Yes  |

**Parameters[](#parameters "이 제목의 퍼머링크")**

|                 |          |                                                                                                                                                                                                                                                   |               |         |
| :-------------- | :------- | :------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | :------------ | :------ |
| Name            | Required | Description                                                                                                                                                                                                                                       | Default Value | Example |
| oauth\_token    | required | 여기서의 oauth\_token 값은 request\_token 단계에서 반환된 oauth\_token 값과 동일해야 합니다.                                                                                                                                                                            |               |         |
| oauth\_verifier | required | OAuth 웹 플로를 사용하는 경우, 이 매개변수를 콜백 URL에서 반환된 *oauth\_verifier* 값으로 설정합니다. Out-of-band OAuth를 사용하는 경우, 이 값을 PIN 코드로 설정합니다. OAuth 1.0a 규격을 준수하기 위해 이 매개변수는 **필수**입니다. OAuth 1.0a는 엄격하게 적용되며, \_oauth\_verifier\_를 사용하지 않는 애플리케이션은 OAuth 플로를 완료하지 못합니다. |               |         |

**Example request[](#example-request "이 제목의 퍼머링크")**

`POST https://api.x.com/oauth/access_token?oauth_token=qLBVyoAAAAAAx72QAAATZxQWU6P&oauth_verifier=ghLM8lYmAxDbaqL912RZSRjCCEXKDIzx`

PIN 기반 `POST https://api.x.com/oauth/access_token?oauth_token=9Npq8AAAAAAAx72QBRABZ4DAfY9&oauth_verifier=4868795`

**Example response[](#example-response "이 제목의 퍼머링크")**

`oauth_token=6253282-eWudHldSbIaelX7swmsiHImEL4KinwaGloHANdrY&oauth_token_secret=2EEfA6BG5ly3sR3XjE0IBSnlQu4ZrUzPiYTmrkVU&user_id=6253282&screen_name=xapi`

<div id="post-oauthinvalidate_token">
  ### POST oauth/invalidate\_token
</div>

등록된 애플리케이션이 클라이언트 자격 증명을 제시하여 발급된 OAuth access\_token을 취소(무효화)할 수 있습니다. access\_token이 무효화되면, 이후 새 access\_token을 발급하려는 시도에서는 서로 다른 access\_token이 생성되며, 무효화된 토큰은 더 이상 사용할 수 없습니다.

**리소스 URL[](#resource-url "Permalink to this headline")**

`https://api.x.com/1.1/oauth/invalidate_token`

**리소스 정보[](#resource-information "Permalink to this headline")**

|             |                                       |
| :---------- | :------------------------------------ |
| 응답 형식       | JSON                                  |
| 인증 필요 여부    | 예 - 무효화하려는 access\_token이 있는 사용자 컨텍스트 |
| 요청 한도 적용 여부 | 예                                     |

**요청 예시[](#example-request "Permalink to this headline")**

```bash theme={null}
        curl --request POST
          --url 'https://api.x.com/1.1/oauth/invalidate_token.json'
          --header 'authorization: OAuth oauth_consumer_key="CLIENT_KEY",
         oauth_nonce="AUTO_GENERATED_NONCE", oauth_signature="AUTO_GENERATED_SIGNATURE",
         oauth_signature_method="HMAC-SHA1", oauth_timestamp="AUTO_GENERATED_TIMESTAMP",
         oauth_token="ACCESS_TOKEN", oauth_version="1.0"'
```

**응답 예시[](#example-response "Permalink to this headline")**

```bash theme={null}
        HTTP/1.1 200 OK
        Content-Type: application/json; charset=utf-8
        Content-Length: 127
        ...

        {"access_token":"ACCESS_TOKEN"}
```

**토큰 무효화 후 오류 응답 예시[](#example-error-response-after-token-has-been-invalidated "이 제목에 대한 고유 링크")**

```bash theme={null}
        HTTP/1.1 401 Authorization Required
        ...

        {"errors": [{
          "code": 89,
          "message": "Invalid or expired token."}
        ]}
```

<div id="post-oauth2token">
  ### POST oauth2/token
</div>

등록된 애플리케이션이 OAuth 2 Bearer 토큰을 획득할 수 있게 해 주며, 이 토큰은 사용자 컨텍스트 없이 애플리케이션 자체 명의로 API 요청을 수행하는 데 사용할 수 있습니다. 이를 [애플리케이션 전용 인증](/ko/resources/fundamentals/authentication/oauth-2-0/application-only)이라고 합니다.

Bearer 토큰은 oauth2/invalidate\_token을 사용해 무효화할 수 있습니다. Bearer 토큰이 한 번 무효화되면, 새로 생성을 시도할 때마다 다른 Bearer 토큰이 반환되며, 이전 토큰은 더 이상 사용할 수 없습니다.

하나의 애플리케이션에는 동시에 하나의 Bearer 토큰만 존재할 수 있으며, 이 메서드에 반복해서 요청을 보내더라도 토큰이 무효화되기 전까지는 이미 존재하는 동일한 토큰이 반환됩니다.

요청이 성공하면 부여된 Bearer 토큰을 설명하는 JSON 구조가 응답에 포함됩니다.

이 메서드를 통해 받은 토큰은 캐시해야 합니다. 이 엔드포인트를 너무 자주 호출하면, 요청은 코드 99와 함께 HTTP 403으로 거부됩니다.

**리소스 URL[](#resource-url "Permalink to this headline")**

`https://api.x.com/oauth2/token`

**리소스 정보[](#resource-information "Permalink to this headline")**

|                          |                                                                   |
| :----------------------- | :---------------------------------------------------------------- |
| Response formats         | JSON                                                              |
| Requires authentication? | 예 - API key를 사용자 이름으로, API key secret을 비밀번호로 사용하는 Basic 인증이 필요합니다 |
| Rate limited?            | 예                                                                 |

**매개변수[](#parameters "Permalink to this headline")**

|             |          |                                                                                                                                                                             |               |                       |
| :---------- | :------- | :-------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | :------------ | :-------------------- |
| Name        | Required | Description                                                                                                                                                                 | Default Value | Example               |
| grant\_type | required | 애플리케이션이 요청하는 grant의 유형(type)을 지정합니다. 현재는 *client\_credentials*만 허용됩니다. 자세한 내용은 [애플리케이션 전용 인증](/ko/resources/fundamentals/authentication/oauth-2-0/application-only)을 참조하세요. |               | *client\_credentials* |

**요청 예시[](#example-request "Permalink to this headline")**

```bash theme={null}
    POST /oauth2/token HTTP/1.1
    Host: api.x.com
    User-Agent: My X App v1.0.23
    Authorization: Basic eHZ6MWV2R ... o4OERSZHlPZw==
    Content-Type: application/x-www-form-urlencoded;charset=UTF-8
    Content-Length: 29
    Accept-Encoding: gzip

    grant_type=client_credentials
```

**응답 예시:**

```bash theme={null}
    HTTP/1.1 200 OK
    Status: 200 OK
    Content-Type: application/json; charset=utf-8
    ...
    Content-Encoding: gzip
    Content-Length: 140

    {"token_type":"bearer","access_token":"AAAA%2FAAA%3DAAAAAAAA"}
```

<div id="post-oauth2invalidate_token">
  ### POST oauth2/invalidate\_token
</div>

등록된 애플리케이션이 클라이언트 자격 증명을 제시하여 발급된 OAuth 2.0 Bearer 토큰을 취소(무효화)할 수 있도록 합니다. Bearer 토큰이 한 번 무효화되면, 새로 토큰을 발급하려는 시도에서는 다른 Bearer 토큰이 발급되며, 무효화된 토큰은 더 이상 사용할 수 없습니다.

성공한 응답에는 취소된 Bearer 토큰을 나타내는 JSON 구조가 포함됩니다.

**Resource URL[](#resource-url "Permalink to this headline")**

`https://api.x.com/oauth2/invalidate_token`

**Resource Information[](#resource-information "Permalink to this headline")**

|                          |                                                                                                                                                       |
| :----------------------- | :---------------------------------------------------------------------------------------------------------------------------------------------------- |
| Response formats         | JSON                                                                                                                                                  |
| Requires authentication? | Yes - 애플리케이션의 consumer API 키와 애플리케이션 소유자의 access token & access token secret를 사용하는 [OAuth 1.0a](/ko/resources/fundamentals/authentication/oauth-1-0a) |
| Rate limited?            | Yes                                                                                                                                                   |

**Parameters[](#parameters "Permalink to this headline")**

| Name          | Required | Description        |
| :------------ | :------- | :----------------- |
| access\_token | required | 무효화하려는 Bearer 토큰 값 |

**Example request[](#example-request "Permalink to this headline")**

```
        curl --request POST
          --url 'https://api.x.com/oauth2/invalidate_token?access_token=AAAA%2FAAA%3DAAAAAAAA'
          --header 'authorization: OAuth oauth_consumer_key="CLIENT_KEY",
         oauth_nonce="AUTO_GENERATED_NONCE", oauth_signature="AUTO_GENERATED_SIGNATURE",
         oauth_signature_method="HMAC-SHA1", oauth_timestamp="AUTO_GENERATED_TIMESTAMP",
         oauth_token="ACCESS_TOKEN", oauth_version="1.0"'
```

**응답 예시[](#example-response "이 제목의 고유 링크")**

```
         Status: 200 OK
         Content-Type: application/json; charset=utf-8
         Content-Length: 135
         ...
       {
        "access_token": "AAAA%2FAAA%3DAAAAAAAA"
        }
```
