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

# 인증

> Microsoft Entra ID로 로그인 및 로그아웃하고, 로그인한 사용자를 확인합니다.

`xbox auth`는 다른 명령이 사용하는 Microsoft Entra ID 계정을 관리합니다. 서비스 주체로 로그인하는
방법을 포함하여 로그인이 작동하는 방식은 [인증](https://docs.xbox.com/ko/tools/xbox-cli/authentication.md)을 참조하세요.

```text theme={null}
xbox auth <command>
```

| 명령 | 설명 |
| - | - |
| `xbox auth login` | 시스템 브라우저를 통해 로그인하며, 이미 로그인한 계정을 대체합니다. |
| `xbox auth logout` | 캐시된 모든 계정에서 로그아웃합니다. |
| `xbox auth status` | 로그인한 계정을 표시합니다. |

`--output table`을 허용하는 `auth` 명령은 없습니다.

`XBOX_AUTHENTICATION__MODE`가 서비스 주체 모드를 선택하면 `auth login`과 `auth logout`은 `1`로
종료되고, `auth status`는 서비스 주체를 설명합니다.

## `auth login`

Microsoft Entra ID로 로그인하며, 이미 로그인한 계정을 대체합니다.

```bash theme={null}
xbox auth login
```

이 명령은 시스템 브라우저를 열고, 성공하면 계정과 해당 토큰이 만료되는 시점을 출력합니다. 이후의 모든
명령은 해당 계정을 사용합니다. 예를 들어 이전 CLI 버전으로 인해 둘 이상의 계정이 캐시되어 있으면
`auth login`을 다시 실행할 때까지 명령이 실패합니다.

## `auth logout`

캐시된 모든 계정에서 로그아웃합니다.

```bash theme={null}
xbox auth logout
```

이 명령은 로그아웃한 계정을 출력하거나, 로그인한 계정이 없었음을 출력합니다.
[`context set`](https://docs.xbox.com/ko/tools/xbox-cli/commands/context)으로 저장한 값은 유지되며, 같은 계정으로 다시
로그인하면 복원됩니다.

## `auth status`

로그인한 계정과 해당 토큰을 표시합니다. 이 명령은 Entra ID로 토큰을 새로 고칠 수 있지만 토큰을 사용하지는
않으므로, 다른 명령이 토큰을 허용할지는 확인하지 않습니다.
저장된 판매자와 PlayFab 타이틀을 보려면 [`xbox context get`](https://docs.xbox.com/ko/tools/xbox-cli/commands/context)을 실행하세요.

```bash theme={null}
xbox auth status
```

`--output`을 전달하지 않으면 출력은 텍스트입니다. 스크립트에서는 JSON을 요청하고 `signedIn`을 확인하세요.

```bash theme={null}
xbox auth status --output json-compact
```

```json theme={null}
{"signedIn":false}
```

| 종료 코드 | 의미 |
| - | - |
| `0` | 계정의 로그인 여부와 관계없이 상태를 읽었습니다. |
| `1` | CLI가 설정 또는 토큰 캐시를 읽을 수 없거나, 서비스 주체 모드에서 토큰을 가져올 수 없습니다. 오류는 stderr에 있으며 stdout은 비어 있습니다. |

### 서비스 주체 모드

서비스 주체 모드에서 `auth status`는 앱 전용 토큰을 가져와 해당 클레임을 보고합니다. 토큰 자체는 절대
출력하지 않습니다.

```bash theme={null}
XBOX_AUTHENTICATION__MODE=azurecli xbox auth status --output json
```

```json theme={null}
{
  "signedIn": true,
  "authenticationMode": "azurecli",
  "principalType": "app",
  "tenantId": "00000000-0000-0000-0000-000000000000",
  "appId": "11111111-1111-1111-1111-111111111111",
  "objectId": "22222222-2222-2222-2222-222222222222",
  "audience": "api://example",
  "roles": [],
  "tokenType": "Bearer",
  "tokenExpiresAt": "2030-01-01T00:00:00+00:00",
  "scopes": ["<scope>/.default"]
}
```

서비스 주체 또는 관리 ID의 경우 `principalType`은 `app`입니다.
[ID 확인](https://docs.xbox.com/ko/tools/xbox-cli/authentication.md#confirm-the-identity)을 참조하세요.


## Related topics

- [인증](https://docs.xbox.com/ko/services/playfab/identity/player-identity/authentication/index.md)
- [인증(Certify)](https://docs.xbox.com/ko/publishing/game-publishing/concepts/certification/certification-overview.md)
- [게임 인증](https://docs.xbox.com/ko/publishing/game-publishing/tutorial-xbox-managed/how-to-certify-a-game.md)
- [이중 인증](https://docs.xbox.com/ko/services/playfab/identity/dev-identity/authentication/two-factor-authentication.md)
- [서비스 인증](https://docs.xbox.com/ko/services/xbox-services/fundamentals/s2s-auth-calls/service-authentication/index.md)
