Method: accounts.signInWithGameCenter

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 is required in the request in order to identify the Google Cloud project.

Apple has deprecated the playerID field. 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 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 (int64 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 (int64 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.