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

# OAuth API 레퍼런스 인덱스

> OAuth 1.0a 및 OAuth 2.0에 걸친 X 인증 엔드포인트의 레퍼런스 인덱스로, 요청 토큰, 인증, 액세스 토큰, 토큰 취소를 포함합니다.

### OAuth 1.0a

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

### OAuth 2.0 Bearer Token

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

### POST oauth/request\_token

Consumer 애플리케이션이 사용자 인증을 요청하기 위한 OAuth Request Token을 얻을 수 있게 합니다. 이 메서드는 [OAuth 1.0 authentication flow](http://oauth.net/core/1.0/#anchor9)의 [Section 6.1](https://oauth.net/core/1.0/#auth_step1)을 충족합니다.

**모든 OAuth 인증 단계에서 HTTPS 사용이 요구됩니다.**

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

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

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

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

|        |      |
| :----- | :--- |
| 응답 형식  | JSON |
| 인증 필요? | 아니요  |
| 속도 제한? | 예    |

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

| 이름                    | 필수 여부 | 설명                                                                                                                                                                                                                                                                                                                                 | 예시                                                               |
| :-------------------- | :---- | :--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | :--------------------------------------------------------------- |
| oauth\_callback       | 필수    | OAuth 1.0a 규정 준수를 위해 이 매개변수는 **필수**입니다. 여기에 지정한 값은 사용자가 애플리케이션의 계정 액세스를 승인한 경우 리다이렉트될 URL로 사용됩니다. out-of-band pin 모드의 경우 `oob`로 설정하세요. 이는 데스크톱/모바일 애플리케이션에서 사용할 사용자 정의 콜백을 지정하는 방법이기도 합니다. 사전에 콜백을 등록했는지 여부와 관계없이 이 단계에서는 항상 `oauth_callback`을 보내십시오.<br /><br />이 엔드포인트와 함께 사용되는 콜백 URL은 developer.x.com의 App 설정 내에서 구성되어야 합니다.\* | `http://themattharris.local/auth.php` `twitterclient://callback` |
| x\_auth\_access\_type | 선택    | 애플리케이션이 사용자 계정에 대해 요청하는 액세스 수준을 재정의합니다. 지원되는 값은 `read` 또는 `write`입니다. 이 매개변수는 개발자가 read/write 애플리케이션을 등록하되 적절한 경우 read only 액세스를 요청할 수 있도록 하기 위한 것입니다.                                                                                                                                                                             |                                                                  |

콜백 URL을 승인하는 방법은 [이 페이지](/resources/fundamentals/developer-apps#callback-urls)에서 자세히 알아보세요.

**참고** - developer.x.com에서 X 계정으로 로그인한 경우 [X 앱 대시보드](https://developer.x.com/en/apps)를 통해 기존 [X 앱](/resources/fundamentals/developer-apps)을 보고 편집할 수 있습니다.

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

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

요청 POST 본문: *해당 없음*

Authorization 헤더: `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"`

응답: `oauth_token=Z6eEdO8MOmk394WozF5oKyuAv855l4Mlqo7hhlSLik&oauth_token_secret=Kd75W4OQfb2oJTV0vzGzeXftVAwgMnEK9MumzYcM&oauth_callback_confirmed=true`

### GET oauth/authorize

Consumer 애플리케이션이 사용자 인증을 요청하기 위해 OAuth Request Token을 사용할 수 있게 합니다. 이 메서드는 [OAuth 1.0 authentication flow](http://oauth.net/core/1.0/#anchor9)의 [Section 6.2](http://oauth.net/core/1.0/#auth_step2)를 충족합니다. 데스크톱 애플리케이션은 이 메서드를 사용해야 하며 ([GET oauth / authenticate](/resources/fundamentals/authentication/api-reference#get-oauth-authenticate)는 사용할 수 없습니다).

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

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

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

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

|        |      |
| :----- | :--- |
| 응답 형식  | JSON |
| 인증 필요? | 예    |
| 속도 제한? | 예    |

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

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

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

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

### GET oauth/authenticate

Consumer 애플리케이션이 사용자 인증을 요청하기 위해 OAuth `request_token`을 사용할 수 있게 합니다.

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

이 메서드는 [GET oauth / authorize](/resources/fundamentals/authentication/api-reference#get-oauth-authorize)와 달리, 사용자가 이미 애플리케이션 권한을 부여한 경우 사용자가 다시 애플리케이션을 승인하지 않고도 리다이렉트가 발생합니다. 이 동작을 구현하려면 [애플리케이션 레코드](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 정보[](#resource-information "Permalink to this headline")**

|        |      |
| :----- | :--- |
| 응답 형식  | JSON |
| 인증 필요? | 예    |
| 속도 제한? | 예    |

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

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

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

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

### POST oauth/access\_token

Consumer 애플리케이션이 OAuth Request Token을 OAuth Access Token으로 교환할 수 있게 합니다. 이 메서드는 [OAuth 1.0 authentication flow](http://oauth.net/core/1.0/#anchor9)의 [Section 6.3](http://oauth.net/core/1.0/#auth_step3)을 충족합니다.

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

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

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

|        |      |
| :----- | :--- |
| 응답 형식  | JSON |
| 인증 필요? | 예    |
| 속도 제한? | 예    |

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

|                 |       |                                                                                                                                                                                                                                                    |     |    |
| :-------------- | :---- | :------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | :-- | :- |
| 이름              | 필수 여부 | 설명                                                                                                                                                                                                                                                 | 기본값 | 예시 |
| oauth\_token    | 필수    | 여기의 oauth\_token은 request\_token 단계에서 반환된 oauth\_token과 동일해야 합니다.                                                                                                                                                                                  |     |    |
| oauth\_verifier | 필수    | OAuth web-flow를 사용하는 경우, 이 매개변수를 콜백 URL에 반환된 *oauth\_verifier* 값으로 설정하세요. out-of-band OAuth를 사용하는 경우 이 값을 pin-code로 설정하세요. OAuth 1.0a 규정 준수를 위해 이 매개변수는 **필수**입니다. OAuth 1.0a는 엄격하게 시행되며 \_oauth\_verifier\_를 사용하지 않는 애플리케이션은 OAuth 흐름을 완료하지 못합니다. |     |    |

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

`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 "Permalink to this headline")**

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

### POST oauth/invalidate\_token

등록된 애플리케이션이 클라이언트 자격 증명을 제시하여 발급된 OAuth access\_token을 취소할 수 있게 합니다. access\_token이 무효화되면 새 생성 시도에서 다른 Access Token이 생성되며 무효화된 토큰의 사용은 더 이상 허용되지 않습니다.

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

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

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

|        |                                    |
| :----- | :--------------------------------- |
| 응답 형식  | JSON                               |
| 인증 필요? | 예 - 무효화하려는 액세스 토큰이 있는 User context |
| 속도 제한? | 예                                  |

**예시 요청[](#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 "Permalink to this headline")**

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

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

### POST oauth2/token

등록된 애플리케이션이 사용자 컨텍스트 없이 애플리케이션 자체를 대신하여 API 요청을 수행하는 데 사용할 수 있는 OAuth 2 Bearer Token을 얻을 수 있게 합니다. 이를 [Application-only authentication](/resources/fundamentals/authentication/oauth-2-0/application-only)이라고 합니다.

Bearer Token은 oauth2/invalidate\_token을 사용하여 무효화할 수 있습니다. Bearer Token이 무효화되면 새 생성 시도에서 다른 Bearer Token이 생성되며 이전 토큰의 사용은 더 이상 허용되지 않습니다.

애플리케이션당 하나의 bearer token만 미해결 상태로 존재할 수 있으며, 이 메서드에 반복적으로 요청하면 무효화될 때까지 이미 존재하는 동일한 토큰이 생성됩니다.

성공 응답에는 부여된 Bearer Token을 설명하는 JSON 구조가 포함됩니다.

이 메서드로 받은 토큰은 캐시되어야 합니다. 너무 자주 시도하면 요청이 code 99와 함께 HTTP 403으로 거부됩니다.

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

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

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

|        |                                                       |
| :----- | :---------------------------------------------------- |
| 응답 형식  | JSON                                                  |
| 인증 필요? | 예 - API 키를 사용자 이름으로, API 키 시크릿을 비밀번호로 사용하는 Basic auth |
| 속도 제한? | 예                                                     |

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

|             |       |                                                                                                                                                                                        |     |                       |
| :---------- | :---- | :------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | :-- | :-------------------- |
| 이름          | 필수 여부 | 설명                                                                                                                                                                                     | 기본값 | 예시                    |
| grant\_type | 필수    | 애플리케이션이 요청하는 grant 유형을 지정합니다. 현재는 \_client\_credentials\_만 허용됩니다. 자세한 내용은 [Application-Only Authentication](/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"}
```

### POST oauth2/invalidate\_token

등록된 애플리케이션이 클라이언트 자격 증명을 제시하여 발급된 oAuth 2.0 Bearer Token을 취소할 수 있게 합니다. Bearer Token이 무효화되면 새 생성 시도에서 다른 Bearer Token이 생성되며 무효화된 토큰의 사용은 더 이상 허용되지 않습니다.

성공 응답에는 취소된 Bearer Token을 설명하는 JSON 구조가 포함됩니다.

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

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

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

|        |                                                                                                                                   |
| :----- | :-------------------------------------------------------------------------------------------------------------------------------- |
| 응답 형식  | JSON                                                                                                                              |
| 인증 필요? | 예 - 애플리케이션의 consumer API 키와 애플리케이션 소유자의 액세스 토큰 및 액세스 토큰 시크릿을 사용하는 [oAuth 1.0a](/resources/fundamentals/authentication/oauth-1-0a) |
| 속도 제한? | 예                                                                                                                                 |

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

| 이름            | 필수 여부 | 설명                     |
| :------------ | :---- | :--------------------- |
| access\_token | 필수    | 무효화하려는 bearer token의 값 |

**예시 요청[](#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 "Permalink to this headline")**

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