# Method: accounts.signInWithGameCenter

- [HTTP request](https://docs.cloud.google.com/identity-platform/docs/reference/rest/v1/accounts/signInWithGameCenter#body.HTTP_TEMPLATE)
- [Request body](https://docs.cloud.google.com/identity-platform/docs/reference/rest/v1/accounts/signInWithGameCenter#body.request_body)
  - [JSON representation](https://docs.cloud.google.com/identity-platform/docs/reference/rest/v1/accounts/signInWithGameCenter#body.request_body.SCHEMA_REPRESENTATION)
- [Response body](https://docs.cloud.google.com/identity-platform/docs/reference/rest/v1/accounts/signInWithGameCenter#body.response_body)
  - [JSON representation](https://docs.cloud.google.com/identity-platform/docs/reference/rest/v1/accounts/signInWithGameCenter#body.SignInWithGameCenterResponse.SCHEMA_REPRESENTATION)
- [Authorization scopes](https://docs.cloud.google.com/identity-platform/docs/reference/rest/v1/accounts/signInWithGameCenter#body.aspect)
- [Try it!](https://docs.cloud.google.com/identity-platform/docs/reference/rest/v1/accounts/signInWithGameCenter#try-it)

Signs in or signs up a user with iOS Game Center credentials. If the sign-in succeeds, a new Identity Platform ID token and refresh token are issued for the authenticated user. The bundle ID is required in the request header as `x-ios-bundle-identifier`.

An [API key](https://cloud.google.com/docs/authentication/api-keys) is required in the request in order to identify the Google Cloud project.

Apple has [deprecated the `playerID` field](https://developer.apple.com/documentation/gamekit/gkplayer/1521127-playerid/). The Apple platform Firebase SDK will use `gamePlayerID` and `teamPlayerID` from version 10.5.0 and onwards. Upgrading to SDK version 10.5.0 or later updates existing integrations that use `playerID` to instead use `gamePlayerID` and `teamPlayerID`. When making calls to `signInWithGameCenter`, you must include `playerID` along with the new fields `gamePlayerID` and `teamPlayerID` to successfully identify all existing users.

Upgrading existing Game Center sign in integrations to SDK version 10.5.0 or later is irreversible.

### HTTP request

`POST https://identitytoolkit.googleapis.com/v1/accounts:signInWithGameCenter`

The URL uses [gRPC Transcoding](https://google.aip.dev/127) syntax.

### Request body

The request body contains data with the following structure:

| JSON representation |
|---|
| ``` { "playerId": string, "publicKeyUrl": string, "signature": string, "salt": string, "timestamp": string, "idToken": string, "displayName": string, "tenantId": string, "teamPlayerId": string, "gamePlayerId": string } ``` |

| Fields ||
|---|---|
| `playerId` | `string` Required. The user's Game Center player ID. Deprecated by Apple. Pass `playerID` along with `gamePlayerID` and `teamPlayerID` to initiate the migration of a user's Game Center player ID to `gamePlayerID`. |
| `publicKeyUrl` | `string` Required. The URL to fetch the Apple public key in order to verify the given signature is signed by Apple. |
| `signature` | `string` Required. The verification signature data generated by Apple. |
| `salt` | `string` Required. A random string used to generate the given signature. |
| `timestamp` | `string (https://developers.google.com/discovery/v1/type-format format)` Required. The time when the signature was created by Apple, in milliseconds since the epoch. |
| `idToken` | `string` A valid ID token for an Identity Platform account. If present, this request will link the Game Center player ID to the account represented by this ID token. |
| `displayName` | `string` The user's Game Center display name. |
| `tenantId` | `string` The ID of the Identity Platform tenant the user is signing in to. |
| `teamPlayerId` | `string` The user's Game Center team player ID. A unique identifier for a player of all the games that you distribute using your developer account. <https://developer.apple.com/documentation/gamekit/gkplayer/3174857-teamplayerid> |
| `gamePlayerId` | `string` The user's Game Center game player ID. A unique identifier for a player of the game. <https://developer.apple.com/documentation/gamekit/gkplayer/3113960-gameplayerid> |

### Response body

Response message for accounts.signInWithGameCenter

If successful, the response body contains data with the following structure:

| JSON representation |
|---|
| ``` { "localId": string, "playerId": string, "idToken": string, "refreshToken": string, "expiresIn": string, "isNewUser": boolean, "displayName": string, "teamPlayerId": string, "gamePlayerId": string } ``` |

| Fields ||
|---|---|
| `localId` | `string` The ID of the authenticated user. Always present in the response. |
| `playerId` | `string` The user's Game Center player ID. Pass `playerID` along with `gamePlayerID` and `teamPlayerID` to initiate the migration of a user's Game Center player ID to `gamePlayerID`. |
| `idToken` | `string` An Identity Platform ID token for the authenticated user. |
| `refreshToken` | `string` An Identity Platform refresh token for the authenticated user. |
| `expiresIn` | `string (https://developers.google.com/discovery/v1/type-format format)` The number of seconds until the ID token expires. |
| `isNewUser` | `boolean` Whether the logged in user was created by this request. |
| `displayName` | `string` Display name of the authenticated user. |
| `teamPlayerId` | `string` The user's Game Center team player ID. A unique identifier for a player of all the games that you distribute using your developer account. <https://developer.apple.com/documentation/gamekit/gkplayer/3174857-teamplayerid> |
| `gamePlayerId` | `string` The user's Game Center game player ID. A unique identifier for a player of the game. <https://developer.apple.com/documentation/gamekit/gkplayer/3113960-gameplayerid> |

### Authorization scopes

Requires one of the following OAuth scopes:

- `https://www.googleapis.com/auth/identitytoolkit`
- `
  https://www.googleapis.com/auth/cloud-platform`

For more information, see the [Authentication Overview](https://docs.cloud.google.com/docs/authentication#authorization-gcp).