iOS
This article guides you through setting up Ubisoft as an identity provider, enabling your iOS game to access Player Network authentication services.
Prerequisites
1. Set up the Ubisoft app
Contact Ubisoft for the following app configuration parameters.
- App ID
- GENOME ID
- Game SKU
- Login Landing Page URL
- Create an account for Player Network Console.
- Create a new project for your game, or join an existing one.
- Download the SDK.
- Integrate the SDK.
- Add Ubisoft as an authentication method for your project on Player Network Console.
Step 1: Configure the SDK
Ubisoft SDK is only compatible with iOS SDK 12 and above.
IDE: Xcode 13.3 or later
iOS: iOS 12.0 or later
Add the following configuration in the project file INTLConfig.ini.
[Ubisoft]
UBI_APP_ID_IOS = {INTL_UBI_APP_ID_IOS}
UBI_GENOME_ID_IOS = {INTL_UBI_GENOME_ID_IOS}
UBI_APP_BUILDID_IOS = {INTL_UBI_APP_BUILDID_IOS}
UBI_GAME_VERSION_IOS = {INTL_UBI_GAME_VERSION_IOS}
UBI_SKU = {INTL_UBI_SKU}
UBI_WEB_AUTH_URL = {INTL_UBI_WEB_AUTH_URL}- Replace
{INTL_UBI_APP_ID_IOS}
with the iOS app ID provided by Ubisoft. - Replace
{INTL_UBI_GENOME_ID_IOS}
with the iOS GENOME ID provided by Ubisoft. - Replace
{INTL_UBI_APP_BUILDID_IOS}
with the detailed iOS version number of the game. - Replace
{INTL_UBI_GAME_VERSION_IOS}
with the custom version type of the game, such as Alpha, Beta, Test, and Full. - Replace
{INTL_UBI_SKU}
with the Game SKU provided by Ubisoft. - Replace
{INTL_UBI_WEB_AUTH_URL}
with the login landing page URL provided by Ubisoft.
- Replace
Set Keychain sharing.
Ubisoft SDK requires users to enable the Keychain Sharing function for iOS app and set a keychain group namedcom.ubisoft.data
. Specific configuration steps are as follows:Click Target and select Signing & Capabilities.
Click Keychain Sharing. If Keychain Sharing is not enabled, enable it.
Click the plus sign (+) and add a keychain group named
com.ubisoft.data
.
Step 2: Add Ubisoft login
The SDK will call up WebView and go to the Ubisoft login page. After logging in to the Ubisoft account in the browser, users will return to the game to continue the Ubisoft SDK login process.
Add an observer to handle authentication callbacks.
- Unity
- Unreal Engine
Currently, the Ubisoft channel in the Player Network SDK does not support the Unity engine.
C++ Event Handling (above v1.15)
//configure callback
FINTLAuthEvent authEvent;
authEvent.AddUObject(this, &OnAuthResult_Implementation);
UINTLSDKAPI::SetAuthResultObserver(authEvent);
// Remove callbacks
UINTLSDKAPI::GetAuthResultObserver().Clear();void OnAuthResult_Implementation(FINTLAuthResult ret)
{
UE_LOG(LogTemp, Warning, TEXT("MethodID: %d"), ret.MethodId);
}Unreal Event Handling
void OnAuthResult_Implementation(FINTLAuthResult ret)
{
UE_LOG(LogTemp, Warning, TEXT("MethodID: %d"), ret.MethodId);
}Call the
AutoLogin
method.If users have previously logged in, the game backend can achieve automatic login by calling the auto-login interface. If their login token is still valid, they will log in successfully. If the token has expired, the system throws an exception and the game calls the manual login API.
- Unity
- Unreal Engine
Currently, the Ubisoft channel in the Player Network SDK does not support the Unity engine.
UINTLSDKAPI::AutoLogin();
Call the
Login
method to ask for user input if auto-login fails.- Unity
- Unreal Engine
Currently, the Ubisoft channel in the Player Network SDK does not support the Unity engine.
UINTLSDKAPI::Login(EINTLLoginChannel::kChannelUbisoft);
// Ubisoft DNA data event reporting definition, which can be passed to Ubisoft channel plugins through the UbDnaEvents parameter to complete Ubisoft SDK initialization. JSON sample:
FString extraJson = "{\"UbDnaEvents\": \"events definition generated from Ubi Event SDK\"}";
// After supporting guest login for Ubisoft, call the Login API with different extraJson for different login flows.
UINTLSDKAPI::Login(EINTLLoginChannel::kChannelUbisoft, "", extraJson);Supported
extraJson
:- Log in with Ubisoft account:
extraJson = "{\"ubiLoginType\" : \"ubiLoginTypeFormal\"}"
- Link Ubisoft account to existing guest account:
extraJson = "{\"ubiLoginType\" : \"ubiLoginTypeFormalBindGuest\", \"ubiLoginTypeFormalBindGuest\" : \"ubiLoginTypeFormalBindGuestCur\"}"
- Link Ubisoft account to new guest account:
extraJson = "{\"ubiLoginType\" : \"ubiLoginTypeFormalBindGuest\", \"ubiLoginTypeFormalBindGuest\" : \"ubiLoginTypeFormalBindGuestNew\"}"
- Log in with guest account:
extraJson = "{\"ubiLoginType\" : \"ubiLoginTypeGuest\"}"
- Link guest account to Ubisoft account:
extraJson = "{\"ubiLoginType\" : \"ubiLoginTypeGuestBindFormal\", \"ubiLoginTypeGuestBindFormal\" : \"ubiLoginTypeGuestBindFormalBind\"}"
For players logging in through Ubisoft Connect, if Ubisoft Connect returns
-20000
, it indicates that the device has a local guest account, and the game client should prompt the player to link the existing guest account or link a new guest account.- To link the existing guest account, games should call
Login
again and pass the "extraJson" for "Link Ubisoft account to existing guest account." - To link a new guest account, games should call
Login
again and pass theextraJson
for "Link Ubisoft account to new guest account".
For players logging in with a guest account, they can enter the account settings and link to a Ubisoft account. Games should call the extended APIs which will invoke UbisoftWebAuth for players to log in with their Ubisoft account and password. Once the login is successful, the ubiservicesSDK requests the ubiserver to verify if the Unisoft account can be linked to the guest account.
- If ubiserver returns
-10000
, the Ubisoft account can be linked, and players can continue with the linking workflow. Games should callLogin
again and pass theextraJson
for "Link guest account to Ubisoft account". - If ubiserver returns
-10001
, the Unisoft account cannot be linked.
Sync client authentication state with the game's backend and wait for the final authentication result.
Returns AuthResult, data format for channel_info
as follows:
"channel_info":"
{
\"expire_ts\":1651047328,
\"is_refresh\":0,
\"profile_id\":\"xxxxxxxx-xxxx-xxxx-xxxx-f34e406412d6\",
\"sesssion_id\":\"xxxxxxxx-xxxx-xxxx-xxxx-d82d645f5df0\",
\"ticket\":\"...\",
\"user_id\":\"xxxxxxxx-xxxx-xxxx-xxxx-F88B443D15D6\"
}",
Logout
Call the Logout
API to log out of the current channel and pass relevant parameters.
- Unity
- Unreal Engine
Currently, the Ubisoft channel in the Player Network SDK does not support the Unity engine.
UINTLSDKAPI::Logout();
Step 3: Test the login function
Search for the keyword "AuthResult" in the Player Network SDK logs to verify if the correct channel name and OpenID are returned. If they are, it indicates a successful configuration and the login function has been added successfully.
Extended APIs
Extended APIs
Link Guest Account to Ubisoft Account
- Unity
- Unreal Engine
Currently, the Ubisoft channel in the Player Network SDK does not support the Unity engine.
// Follow the instructions in manual login, call ExtendInvoke with “guestBindFormalAccountLogin” to open webAuth
UINTLSDKAPI::ExtendInvoke(EINTLLoginChannel::kChannelUbisoft, "guestBindFormalAccountLogin", "");
Get Ubisoft DNA Event Reporting Facade
- Unity
- Unreal Engine
Currently, the Ubisoft channel in the Player Network SDK does not support the Unity engine.
// "unsigned int64" string, you should cast it to Facade pointer
FString facadePtr = UINTLSDKAPI::ExtendInvoke(EINTLLoginChannel::kChannelUbisoft, "getUbDnaFacade", "");
Set Ubisoft DNA Not Reporting Session Events
- Unity
- Unreal Engine
Currently, the Ubisoft channel in the Player Network SDK does not support the Unity engine.
FString paramsJson; // {"events": "events json string"}
UINTLSDKAPI::ExtendInvoke(EINTLLoginChannel::kChannelUbisoft, "setUbLastSessionEvents", paramsJson);
Get the User ID of the Ubisoft Channel
- Unity
- Unreal Engine
Currently, the Ubisoft channel in the Player Network SDK does not support the Unity engine.
FString ubiUserID = UINTLSDKAPI::ExtendInvoke(EINTLLoginChannel::kChannelUbisoft, "getUbUserId", "");
If you have trouble logging in through Ubisoft, see Ubisoft FAQs.