MergeGameCenterIdentity
Merge the profile associated with the specified Game Center identity with the current profile.
NOTE: If using the BrainCloudWrapper, once the merge is complete you should call SetStoredProfileId in the BrainCloudWrapper with the profileId returned in the Merge call.
| Service | Operation |
|---|---|
| identity | MERGE |
Method Parameters
| Parameter | Description |
|---|---|
| gameCenterId | The user's Game Center ID — can be the PlayerId, GamePlayerId, or TeamPlayerId from the GKLocalPlayer object |
| timestamp | The timestamp value returned as part of the identity verification signature fetch from Game Center. Required for modern Game Center verification. |
| publicKeyUrl | The public key URL returned as part of the identity verification signature fetch from Game Center. Required for modern Game Center verification. |
| signature | The raw signature bytes returned from Game Center (via GetSignature()). Required for modern Game Center verification. |
| salt | The raw salt bytes returned from Game Center (via GetSalt()). Required for modern Game Center verification. |
| teamPlayerId | Only required when gameCenterId is set to a value other than TeamPlayerId. |
Usage
http://localhost:3000
- C#
- C++
- Obj-C
- Java
- JavaScript
- Dart
- Roblox
- GDScript
- Cloud Code
- Raw
string gameCenterId = "someId"; // PlayerId, GamePlayerId, or TeamPlayerId
ulong timestamp = 0; // from GKLocalPlayer identity verification
string publicKeyUrl = ""; // from GKLocalPlayer identity verification
byte[] signature = null; // from GKLocalPlayer GetSignature()
byte[] salt = null; // from GKLocalPlayer GetSalt()
string teamPlayerId = ""; // only if gameCenterId is not TeamPlayerId
_bc.IdentityService.MergeGameCenterIdentity(
gameCenterId, timestamp, publicKeyUrl,
signature, salt, teamPlayerId,
SuccessCallback, FailureCallback);
const char* gameCenterId = "someId"; // playerId, gamePlayerId, or teamPlayerId
uint64_t timestamp = 0; // from GKLocalPlayer identity verification
std::string publicKeyUrl = ""; // from GKLocalPlayer identity verification
const uint8_t* signature = NULL; // from GKLocalPlayer GetSignature()
size_t signatureLength = 0;
const uint8_t* salt = NULL; // from GKLocalPlayer GetSalt()
size_t saltLength = 0;
std::string teamPlayerId = ""; // only if gameCenterId is not teamPlayerId
_bc->getIdentityService()->mergeGameCenterIdentity(
gameCenterId, timestamp, publicKeyUrl,
signature, signatureLength, salt, saltLength,
teamPlayerId, this);
- (void)mergeGameCenterIdentity:(NSString *)gameCenterId
timestamp:(uint64_t)timestamp
publicKeyUrl:(NSString *)publicKeyUrl
signature:(NSData *)signature
salt:(NSData *)salt
teamPlayerId:(NSString *)teamPlayerId
completionBlock:(BCCompletionBlock)cb
errorCompletionBlock:(BCErrorCompletionBlock)ecb
cbObject:(BCCallbackObject)cbObject;
public void mergeGameCenterIdentity(String gameCenterId, long timestamp, String publicKeyUrl, byte[] signature, byte[] salt, String teamPlayerId, IServerCallback callback)
_bc.identity.mergeGameCenterIdentity = function(gameCenterId, timestamp, publicKeyUrl, signature, salt, teamPlayerId, callback)
var gameCenterId = "someId"; // playerId, gamePlayerId, or teamPlayerId
int timestamp = 0; // from GKLocalPlayer identity verification
String publicKeyUrl = ""; // from GKLocalPlayer identity verification
List<int>? signature = null; // from GKLocalPlayer GetSignature()
List<int>? salt = null; // from GKLocalPlayer GetSalt()
String teamPlayerId = ""; // only if gameCenterId is not teamPlayerId
ServerResponse result = await _bc.identityService.mergeGameCenterIdentity(
gameCenterId: gameCenterId,
timestamp: timestamp,
publicKeyUrl: publicKeyUrl,
signature: signature,
salt: salt,
teamPlayerId: teamPlayerId);
if (result.statusCode == 200) {
print("Success");
} else {
print("Failed ${result.error['status_message'] ?? result.error}");
}
local gameCenterId = "someId" -- playerId, gamePlayerId, or teamPlayerId
local timestamp = 0 -- from GKLocalPlayer identity verification
local publicKeyUrl = "" -- from GKLocalPlayer identity verification
local signature = nil -- from GKLocalPlayer GetSignature()
local salt = nil -- from GKLocalPlayer GetSalt()
local teamPlayerId = "" -- only if gameCenterId is not teamPlayerId
local callback = function(result)
if result.statusCode == 200 then
print("Success")
else
print("Failed | " .. tostring(result.status))
end
end
_bc:getIdentityService():mergeGameCenterIdentity(
gameCenterId, timestamp, publicKeyUrl,
signature, salt, teamPlayerId, callback)
var game_center_id = "someId"
var timestamp = 0
var public_key_url = ""
var team_player_id = ""
var result = await _bc.identity_service.merge_game_center_identity(game_center_id)
if result.status == 200:
print("Success")
else:
print("Failed: %s" % result.status_message)
// N/A
// N/A
JSON Response
{
"data": {
"profileId": "f94f7e2d-3cdd-4fd6-9c28-392f7875e9df"
},
"status": 200
}
Common Error Code
Status Codes
| Code | Name | Description |
|---|---|---|
| 40211 | DUPLICATE_IDENTITY_TYPE | Returned when trying to attach an identity type that already exists for that profile. For instance you can have only one Game Center identity for a profile. |