> ## 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 2.0

<div id="bearer-token-also-known-as-app-only">
  ### Bearer 토큰 (앱 전용 인증 방식이라고도 함)
</div>

OAuth 2.0 Bearer 토큰은 [developer App](/ko/resources/fundamentals/developer-apps)을(를) 대신해 요청을 인증합니다. 이 방식은 App에만 특화되어 있으므로, 사용자 계정이 전혀 개입되지 않습니다. 이 방식은 일반적으로 공개 정보에 대한 읽기 전용 액세스만 필요한 개발자에게 적합합니다. 

이 인증 방식에서는 요청에 Bearer 토큰을 함께 전달해야 하며, 이 토큰은 developer App의 Keys and tokens 섹션에서 생성할 수 있습니다. 다음은 가짜 Bearer 토큰을 사용했을 때 요청이 어떻게 보이는지에 대한 예시입니다:

```json theme={null}
  curl "https://api.x.com/2/tweets?ids=1261326399320715264,1278347468690915330" \
  -H "Authorization: Bearer AAAAAAAAAAAAAAAAAAAAAFnz2wAAAAAAxTmQbp%2BIHDtAhTBbyNJon%2BA72K4%3DeIaigY0QBrv6Rp8KZQQLOTpo9ubw5Jt?WRE8avbi"
```

앱 전용 인증을 사용하는 API 호출에는 App 단위로 엔드포인트마다 [요청 한도](/ko/resources/fundamentals/rate-limits)가 적용됩니다.

이 방식을 사용하려면 Bearer 토큰이 필요합니다. 이 Bearer 토큰은 API Key와 Secret을 [POST oauth2/token](/ko/resources/fundamentals/authentication/api-reference#post-oauth2-token) 엔드포인트로 전달하여 생성하거나, [Developer Console](/ko/resources/fundamentals/developer-portal)의 App 설정에 있는 "keys and token" 섹션에서 생성할 수 있습니다.

Bearer 토큰을 철회(revoke)하려면 [POST oauth2/invalidate\_token](/ko/resources/fundamentals/authentication/api-reference#post-oauth2-invalidate-token) 엔드포인트를 사용하거나, App 설정의 "keys and tokens" 섹션에서 해당 Bearer 토큰 옆에 있는 "revoke"를 클릭하면 됩니다.

<div id="oauth-20-authorization-code-flow-with-pkce">
  ### OAuth 2.0 Authorization Code Flow with PKCE
</div>

OAuth 2.0 Authorization Code Flow with PKCE는 다른 사용자를 대신해 인증할 수 있게 해주고, 애플리케이션의 scope를 더 세밀하게 제어할 수 있게 해주며, 여러 기기에 걸친 인가 플로우를 개선합니다. 다시 말해, X를 사용하는 사람들을 위한 애플리케이션을 구축하는 개발자는 자신의 App이 사용자에게 요청하는 정보에 대해 더 많은 제어 권한을 가지게 되며, 이를 통해 최종 사용자에게 정말로 필요한 데이터와 정보만 요청할 수 있게 됩니다.

이 현대적인 인가 프로토콜을 사용하면, 최종 사용자가 여러분의 App 인가에 동의하는 플로우를 보다 간소화된 형태로 제공할 수 있으며, 이때 표시되는 것은 여러분이 요청한 특정 scope만입니다. 이는 데이터 부담을 줄여 줄 뿐만 아니라, 최종 사용자의 신뢰 향상으로도 이어질 수 있습니다.
