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:
Cloud Code Only:
📄️ 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.
📄️ DetachFacebookLimitedIdentity
Detach the Facebook Limited login identity from this profile.
📄️ DetachGameCenterIdentity
Detach the Game Center identity from the current profile.
📄️ DetachGoogleIdentity
Detach the Google identity from this profile.
📄️ DetachGoogleOpenIdIdentity
Detach the Google OpenId identity from this profile.
📄️ DetachNintendoIdentity
Detach the Nintendo identity from this profile.
📄️ DetachOculusIdentity
Detach the Oculus identity from this profile.
📄️ DetachParent
Detaches the parent identity from the current profile.
📄️ DetachParseIdentity
Detach the Parse identity from this profile.
📄️ DetachPeer
Detaches a peer identity from the current profile.
📄️ DetachPlaystation5Identity
Detach the Playstation5 identity from this profile.
📄️ DetachPlaystationNetworkIdentity
Detach the PlaystationNetwork identity from this profile.
📄️ DetachSteamIdentity
Detach the universal identity from the current profile.
📄️ DetachTwitterIdentity
Detach the Twitter identity from this profile.
📄️ DetachUltraIdentity
Detach the Ultra identity from this profile.
📄️ DetachUniversalIdentity
Detach the universal identity from the current profile
📄️ GetChildProfiles
Returns a list of all child profiles in child Apps.
📄️ GetExpiredIdentities
Retrieve a list of all expired identities for the current user. The app may choose to take action and prompt
📄️ GetIdentities
Retrieve a list of all non-anonymous identities for the current user.
📄️ GetIdentityData
Currently, this method is available in Cloud Code scripts and for Ultra authentication type only.
📄️ GetIdentityStatus
Retrieves identity status for given identity type for this profile.
📄️ GetIdentityStatusAndData
Retrieves identity status and data for given identity type for this profile.
📄️ GetPeerProfiles
Returns a list of all peer profiles for this user.
📄️ Merge
Merges an identity from another profile to this player's profile. The left over profile is decided by the higher XP.
📄️ MergeAdvancedIdentity
Merge the profile associated with the provided credentials with the current profile.
📄️ MergeAppleIdentity
Merge the profile associated with the provided Sigh in with Apple credentials with the current profile.
📄️ MergeEmailIdentity
Merge the profile associated with the provided e=mail with the current profile.
📄️ MergeFacebookIdentity
Merge the profile associated with the provided Facebook credentials with the current profile.
📄️ MergeFacebookLimitedIdentity
Merge the user's Facebook Limited login credentials with the current profile.
📄️ MergeGameCenterIdentity
Merge the profile associated with the specified Game Center identity with the current profile.
📄️ MergeGoogleIdentity
Merge the profile associated with the provided Google credentials with the current profile.
📄️ MergeGoogleOpenIdIdentity
Merge the profile associated with the provided Google OpenId credentials with the current profile.
📄️ MergeNintendoIdentity
Merge the profile associated with the provided Nintendo credentials with the current profile.
📄️ MergeOculusIdentity
Merge the user's Oculus credentials with the current profile.
📄️ MergeParseIdentity
Merge the profile associated with the provided Parse credentials with the current profile.
📄️ MergePeerProfile
Merge the peer profile associated with the provided externalId with the current profile.
📄️ MergePlaystation5Identity
Merge the profile associated with the provided Playstation5 credentials with the current profile.
📄️ MergePlaystationNetworkIdentity
Merge the profile associated with the provided PlaystationNetwork credentials with the current profile.
📄️ MergeSteamIdentity
Merge the profile associated with the provided steam ID with the current profile.
📄️ MergeTwitterIdentity
Merge the profile associated with the provided Twitter credentials with the current profile.
📄️ MergeUltraIdentity
Merge the profile associated with the provided Ultra credentials with the current profile.
📄️ MergeUniversalIdentity
Merge the profile associated with the provided user ID with the current profile.
📄️ RefreshIdentity
Refreshes an identity for this player
📄️ SwitchToChildProfile
Switch to a Child Profile
📄️ SwitchToParentProfile
Switch to a Parent profile.
📄️ SwitchToSingletonChildProfile
Switches to a child profile of an app when only one profile exists. If multiple profiles exist this returns an error.
📄️ SysChangeEmailIdentity
Changes email address associated with specified user's email identity.
📄️ UpdateEmailIdentityPassword
Updates the password associated with the user's email identity.
📄️ UpdateUniversalIdLogin
Updates the UniversalId of the current profile. Note - works for non-login versions of UniversalId as well.
📄️ UpdateUniversalIdPassword
Updates the password for the universal id of the current profile.
📄️ VerifyOktaJwt
Used in an External Authentication script to validate an OKTA login.
📄️ VerifySignedJwt
Verifies a signed JWT provided as a string.