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 | |
---|---|
player |
Required. The user's Game Center player ID. Deprecated by Apple. Pass |
public |
Required. The URL to fetch the Apple public key in order to verify the given signature is signed by Apple. |
signature |
Required. The verification signature data generated by Apple. |
salt |
Required. A random string used to generate the given signature. |
timestamp |
Required. The time when the signature was created by Apple, in milliseconds since the epoch. |
id |
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. |
display |
The user's Game Center display name. |
tenant |
The ID of the Identity Platform tenant the user is signing in to. |
team |
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 |
game |
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 | |
---|---|
local |
The ID of the authenticated user. Always present in the response. |
player |
The user's Game Center player ID. Pass |
id |
An Identity Platform ID token for the authenticated user. |
refresh |
An Identity Platform refresh token for the authenticated user. |
expires |
The number of seconds until the ID token expires. |
is |
Whether the logged in user was created by this request. |
display |
Display name of the authenticated user. |
team |
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 |
game |
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.