Identity
The Identity APIs are used to attach additional identities to a profile – these APIs are most commonly used for apps that allow users to begin anonymously, and later encourage them to attach their Facebook ID for additional social features.
The identity APIs are organized into the following operations:
- AttachIdentity – attach an additional identity to the current profile. Note, attaching an authenticated identity to an anonymous profile (i.e. a profile which previously only had an anonymous identity associated with it) – the app should be sure to use the new authenticated identity when logging in as the user in the future. Note – there are special scenarios to consider if the new identity is already associated with another profile [for this app/game] — see below.
- DetachIdentity – used if the user wishes to detach an identity from a profile.
- MergeIdentity – used if the user wants to merge the current profile with a profile associated with a provided identity — see below for more details.
Merging / Switching Profiles
Consider this scenario:
- John played your game on Facebook Canvas
- John decided to also try your game on iOS – and for simplicity sake, decided to skip logging in and continue as an anonymous user to get a feel for your app
- Later, John decides that he'd like to see his friends scores in the leaderboards – so he hit the button to [Connect to Facebook] from the game
- Your game dutifully calls AttachFacebookIdentity – and gets an error because John's Facebook ID is already associated with a different profile (established via the Facebook Canvas version of the game)
At this point, you probably want to offer John two choices:
- He can choose to switch to the other profile (which is already associated with his Facebook identity), abandoning the little bit of campaign history that he may have built up on the iOS version of the game. If he chooses [Switch], the app should re-authenticate with brainCloud, passing in the Facebook Identity and passing in a -1 for the anonymous identity (which indicates to the server that you know that this may switch profiles)
- He can choose to merge the profiles – which is accomplished by calling MergeFacebookIdentity. This will merge the contents of the two profiles, preserving the majority of the data of the profile with the highest XP, and aggregating any of the stats that have been set as "additive" in the Design Portal. In addition, all virtual currency balances will be summed between the two profiles.
Finally, in an alternate version of this scenario John might have a 3rd option. If he'd previously played the app on Android, but still connected to Facebook for it – the same general scenario would have occurred. But John could optionally go to the Android version of the game, choose [Disconnect from Facebook] to detach his Facebook identity, and then go to the iOS game and hit [Connect to Facebook]. The result would be that his Facebook identity has moved from being associated with the Android profile to the iOS profile… (not sure why he'd want that, but it's a valid scenario)
API Summary
Child Profiles:
- SwitchToSingletonChildProfile
- SwitchToChildProfile
- SwitchToParentProfile
- AttachParentWithIdentity
- GetChildProfiles
- DetachParent
Peer:
📄️ Attach
Attach an identity to the current profile.
📄️ AttachAdvancedIdentity
Attach the user's credentials to the current profile.
📄️ AttachAppleIdentity
Attach the user's Sign in with Apple credentials to the current profile.
📄️ AttachBlockchainIdentity
Attaches the given block chain public key identity to the current profile.
📄️ AttachEmailIdentity
Attach a Email and Password identity to the current profile.
📄️ AttachFacebookIdentity
Attach the user's Facebook credentials to the current profile.
📄️ AttachFacebookLimitedIdentity
Attach the user's Facebook Limited login credentials to the current profile.
📄️ AttachGameCenterIdentity
Attach a Game Center identity to the current profile.
📄️ AttachGoogleIdentity
Attach the user's Google credentials to the current profile.
📄️ AttachGoogleOpenIdIdentity
Attach the user's Google OpenId credentials to the current profile.
📄️ AttachNintendoIdentity
Attach the user's Nintendo credentials to the current profile.
📄️ AttachNonLoginUniversalId
Attaches a UniversalId to the current profile with no login capability.
📄️ AttachOculusIdentity
Attach the user's Oculus credentials to the current profile.
📄️ AttachParentWithIdentity
Attach a parent identity to the current profile. Create if necessary.
📄️ AttachParseIdentity
Attach the user's Parse credentials to the current profile.
📄️ AttachPeerProfile
Attach a peer identity profile to the current profile. Create if necessary.
📄️ AttachPlaystation5Identity
Attach the user's PlaystationNetwork credentials to the current profile.
📄️ AttachPlaystationNetworkIdentity
Attach the user's PlaystationNetwork credentials to the current profile.
📄️ AttachSteamIdentity
Attach a Steam (steam ID + steam session ticket) identity to the current profile.
📄️ AttachTwitterIdentity
Attach the user's Twitter credentials to the current profile.
📄️ AttachUltraIdentity
Attach the user's Ultra credentials to the current profile.
📄️ AttachUniversalIdentity
Attach a Universal (userid + password) identity to the current profile.
📄️ ChangeEmailIdentity
Changes email address in email identity for this player
📄️ CreateHandoffId
Creates a handoff authentication id with security token.
📄️ CreateSettopHandoffCode
Creates a settop handoff code that is valid for a limited amount of time, and in accordance with the provided specifications. Use the AuthenticateSettopHandoff call to log the user in via the generated code.
📄️ Detach
Detaches an identity from the current profile.
📄️ DetachAdvancedIdentity
Detach the identity from this profile.
📄️ DetachAppleIdentity
Detach the Sign in with Apple identity from this profile.
📄️ DetachBlockchainIdentity
Detaches the blockchain identity to the current profile.
📄️ DetachEmailIdentity
Detach the e-mail identity from the current profile
📄️ DetachFacebookIdentity
Detach the Facebook identity from this profile.