Login logout
Login in authentication consists of the following steps.
Note
- SDK version below 4.7.0 does not support Helper. Please refer to [the following] for the existing login application method.
- For a description of AuthV4.Helper, please refer to the Authentication page.
Login¶
The login in authentication consists of the following steps.
- Automatic login and implicit login
- Explicit login
- Check IdP account logged in on the device
- Guest login
Authv4Helper is a class that performs a series of processes related to login and is configured to navigate to the appropriate screen based on the response value. Please refer to the following when configuring the login.
Note
Apple does not support Apple Game Center and in-app purchases in iOS enterprise builds. Therefore, implicit login using an Apple Game Center account cannot be used in iOS enterprise builds, and Apple Game Center cannot be used for explicit login either.
Note
- If the game is primarily aimed at children under the age of 13, Google Play game services cannot be applied, and implicit login in Google builds cannot be used. For more details, refer to the Quality Checklist for Google Play Games Services.
- Implicit login for Google Play games should only be attempted during the first login. For more details, refer to the Google developer guide 1.5 Remember if players declined signing-in.
Note
- In China, Google Play games cannot be used, so implicit login cannot be used on Android.
- In China, Facebook cannot be used, so Facebook is not included in the IdP list.
- Since only users with real-name authentication can recharge or consume resources from a Chinese IP (effective from May 1, 2017), guest login is not included in the IdP list that can log in from a Chinese IP.
Note
iOS does not display the login screen even if the Apple Game Center login is canceled. Therefore, the guidance message can either be displayed directly by the SDK calling the showGameCenterLoginCancelDialog()
method of the AuthV4Helper
class or can be chosen to be displayed by the game. If you want to provide a message for the user to reconnect their Game Center account, use the Game Center cancellation guidance message when the callback result of AuthV4.signIn(AuthV4.ProviderType.APPLE, ...)
and AuthV4.connect(AuthV4.ProviderType.APPLE, ...)
is Cancel.
Note
If a user attempts to log in with Apple while their device is not logged in with an Apple ID, the AuthV4Helper class's connect()
, signIn()
methods will trigger an AuthV4SignInAppleUnknown error. The Apple ID login guidance popup will be displayed automatically, so the game studio does not need to display a separate guidance popup.
If a user attempts to log in with Apple while their device is not logged in with an Apple ID, an AuthV4SignInAppleUnknown error occurs during the process of calling the connect()
, signIn()
methods of the AuthV4Helper class here. The Apple ID login guidance popup is automatically displayed, so the game studio does not need to display a separate popup for guidance.
Automatic login and implicit login¶
Automatic login¶
Implicit Login is a method that the user does not select a means of login, but logs in the Apple Game Center account on iOS or the Google Play Games account on Android automatically. Implement the Implicit Login to be executed after failure of Automatic Login.
To use automatic login in the iOS environment, you need to add the Game Center Entitlement. In Unity, if you have checked the 'Apple GameCenter' dependency, it will automatically add the entitlement through the Unity PostProcess. For iOS Native, Xcode will automatically add the Game Center Entitlement.
Offline mode¶
Hive SDK v4 23.1.0 and higher offers an automatic login feature (AuthV4.signIn
using ProviderType.AUTO
, or AuthV4.Helper.signIn
) even when the user's device is not connected to the network. To use the offline mode, follow the instructions below:
In Hive SDK v4 23.1.0 and above, the automatic login feature (AuthV4.signIn
using ProviderType.AUTO
, or AuthV4.Helper.signIn
) can be provided even if the user device is not connected to the network when the app is launched. To use offline mode, please follow the instructions below.
- Activate the offline mode in the Hive Console under App Center > Manage Project > Game Details > Hive Product Settings.
Automatic login on Windows¶
Windows environment supports automatic login, and it can be enabled/disabled in the Hive Console App Center. Note that the Windows automatic login works differently from the automatic login for the mobile environment. The differences are:
- In the mobile environment, a user is kept logged in by automatic login, but in Windows, it is kept only when a user enabled “keep me logged in” checkbox (displayed below the IdP list in login UI). In other circumstances, the login status does not continue.
- In the mobile environment, when you execute AuthV4Helper.Connect and convert to another account, the newly logged in account also is kept logged in by the automatic login, but in Windows, it is not.
Implicit login¶
AuthV4.Helper.signIn
tries Automatic Login by using the authentication token key of PlayerID. If the token key generated from previous login does not exist, the game automatically sign in Apple Game Center for iOS, and Google Play Games for Android. If failed to sign in, it displays a proper login page in accordance with the response.
Note
You must add the Game Center Entitlement to use automatic login. If you have checked the 'Apple GameCenter' dependency, the entitlement will be automatically added through Unity PostProcess.
Note
In case of implementing AuthV4Helper class,
- If user cancelled implicit login to PGS while loading a game, system memorizes the status and does not try implicit login again. Even if auto login is available while player session is valid, the system remember the denied state.
This contents comply with Google Play Games Services guide.
Followings are sample codes to execute Automatic Login.
API Reference: hive.AuthV4.Helper.signIn
// Attempt Hive SDK login (signIn)
AuthV4.Helper.signIn (delegate (ResultAPI result, AuthV4.PlayerInfo playerInfo) {
if (result.isSuccess()) {
// log-in succeed
} else if (result.needExit()) {
// TODO: implement app exit functionality
// Example) Application.Quit();
} else {
switch(result.code) {
case ResultAPI.Code.AuthV4ConflictPlayer:
// account conflict
break;
case ResultAPI.Code.AuthV4HelperImplifiedLoginFail:
// implicit login failed
// ex) AuthV4.showSignIn(...);
break;
default:
// other exceptions
break;
}
}
});
From the perspective of the app developer, it is necessary to have successfully executed AuthV4.Helper.signIn
, AuthV4.showSignIn
, or AuthV4.signInWithAuthKey
at least once while online and received playerId
and playerToken
as a callback. From the user's perspective, the user must have successfully logged into the app at least once while their device is connected to the network. However, if the user's account was suspended or restricted the last time they attempted to log in while online, the user will not be able to log in even in offline mode.
- Activate offline mode in Hive console App Center > Project Management > Game Details > Hive Product Settings.
Automatic login in Windows environment¶
The Windows environment also supports automatic login, which can be activated or deactivated in the Hive Console App Center. However, automatic login in Windows behaves differently than on mobile. The differences in automatic login on Windows are as follows.
- On mobile, the login state is always maintained automatically after logging in, but on Windows, it is only maintained if the user activates the "Keep me logged in" checkbox (displayed at the bottom of the IdP list on the login UI). In other situations, the login state is not maintained.
- When executing AuthV4Helper.Connect, on mobile, if switching to a new account, the new account will also maintain the automatic login state, but on Windows, if switching to a new account, the new account will not maintain the automatic login state.
Implicit sign-in¶
AuthV4.Helper.signIn
attempts to automatically log in using the authentication token key of the PlayerID. If there is no previously logged-in authentication token key, it will automatically log in to Apple Game Center for iOS and Google Play Games for Android. If the login fails, it will configure the appropriate login screen based on the response value.
Note
To use automatic login, you must add the Game Center Entitlement. If you have checked the 'Apple GameCenter' Dependency, it will automatically add the corresponding Entitlement through Unity PostProcess.
Note
When using the AuthV4Helper class
If a user running the game rejects the implicit login attempt during PGS, it will remember this and will no longer attempt implicit login. Even if automatic login is possible while the player session is maintained, it will continue to remember the state of the implicit login being rejected. This content is based on the Google Play Games Services guide.
The following is an example code that performs automatic login.
API Reference: hive.AuthV4.Helper.signIn
// Attempt to sign in (signIn) with Hive SDK
AuthV4.Helper.signIn (delegate (ResultAPI result, AuthV4.PlayerInfo playerInfo) {
if (result.isSuccess()) {
// Login success
} else if (result.needExit()) {
// TODO: Implement app exit functionality
// e.g.) Application.Quit();
} else {
switch (result.code) {
case ResultAPI.Code.AuthV4ConflictPlayer:
// Account conflict
break;
case ResultAPI.Code.AuthV4HelperImplifiedLoginFail:
// Failed implicit login
// ex) AuthV4.showSignIn(...);
break;
default:
// Other exceptions
break;
}
}
});
#include "HiveAuthV4.h"
// Attempt to log in (signIn) to Hive SDK
FHiveAuthV4::Helper::SignIn(FHiveAuthV4HelperDelegate::CreateLambda([this](const FHiveResultAPI& Result, const TOptional<FHivePlayerInfo>& PlayerInfo) {
if (Result.IsSuccess()) {
// Login successful
} else if (Result.NeedExit()) {
// TODO: Implement app exit functionality
// e.g. UKismetSystemLibrary::QuitGame(GetWorld(), nullptr, EQuitPreference::Quit, false);
} else {
switch (Result.Code) {
case FHiveResultAPI::ECode::AuthV4ConflictPlayer:
// Account conflict
break;
case FHiveResultAPI::ECode::AuthV4HelperImplifiedLoginFail:
// Failed implicit login
// ex) FHiveAuthV4::ShowSigIn()
break;
default:
// Other exceptions
break;
}
}
}));
API Reference: Auth4::signIn
// Attempt to sign in (signIn) with Hive SDK
AuthV4::Helper::signIn([=](ResultAPI const & result, std::shared_ptr playerInfo) {
if (result.isSuccess()) {
// Login successful
} else if (result.needExit()) {
// TODO: Implement app exit functionality
// Cocos2d-x engine users
// e.g. exit(0);
// Unreal engine users
// e.g. UKismetSystemLibrary::QuitGame(GetWorld(), nullptr, EQuitPreference::Quit, false);
} else {
switch (result.code) {
case ResultAPI::AuthV4ConflictPlayer:
// Account conflict
break;
case ResultAPI::AuthV4HelperImplifiedLoginFail:
// Implicit login failed
// ex) AuthV4.showSignIn(...);
break;
default:
break;
}
}
});
API Reference: hive.AuthV4.showSignIn
// Attempt to sign in with Hive SDK
AuthV4.Helper.signIn(object : AuthV4.Helper.AuthV4HelperListener {
override fun onAuthV4Helper(result: ResultAPI, playerInfo: AuthV4.PlayerInfo?) {
if (result.isSuccess) {
// Login successful
} else if (result.needExit()) {
// TODO: Implement app exit functionality
// e.g. exitProcess(0)
} else {
when (result.code) {
ResultAPI.Code.AuthV4ConflictPlayer -> {
// Account conflict
}
ResultAPI.Code.AuthV4HelperImplifiedLoginFail -> {
// Failed implicit login
// ex) AuthV4.showSignIn(...);
}
else -> {
// Other exceptional situations
}
}
}
}
})
API Reference: com.hive.AuthV4.showSignIn
// Hive SDK AuthV4 authentication UI request
AuthV4.showSignIn(new AuthV4.AuthV4SignInListener() {
@Override
public void onAuthV4SignIn(ResultAPI result, AuthV4.PlayerInfo playerInfo) {
if (result.isSuccess()) {
// Authentication successful
// playerInfo: Authenticated user information
// Example of retrieving email information
if(playerInfo != null) {
for (Map.Entry<AuthV4.ProviderType, AuthV4.ProviderInfo> entry : playerInfo.getProviderInfoData().entrySet()) {
AuthV4.ProviderInfo providerInfo = entry.getValue();
if (providerInfo.getProviderEmail() != "") {
String email = providerInfo.getProviderEmail();
break;
}
}
}
}
else if (result.needExit()) {
// TODO: Implement app exit functionality
// e.g. System.exit(0);
}
}
});
API Reference: HIVEAuthV4:signIn
var email = String()
// Hive SDK AuthV4 authentication UI request
AuthV4Interface.showSignIn { (result, playerInfo) in
if result.isSuccess() {
// Authentication successful
// playerInfo: Authenticated user information
// Example of retrieving email information
if let playerInfo = playerInfo {
// Searching for providerInfo with providerEmail (currently logged-in provider)
for key in playerInfo.providerInfoData.keys {
if let providerInfo = playerInfo.providerInfoData[key],
providerInfo.providerEmail.count > 0 {
// providerEmail != ""
email = providerInfo.providerEmail
break
}
}
}
} else if result.needExit() {
// TODO: Implement app exit functionality
// e.g. exit(0)
}
}
API Reference: HIVEAuthV4:signIn
// Attempt to sign in (signIn) with Hive SDK
[[HIVEAuthV4 helper] signIn:^(HIVEResultAPI *result, HIVEPlayerInfo *playerInfo) {
if (result.isSuccess) {
// Login successful
}
else if (result.needExit) {
// TODO: Implement app exit functionality
// ex) exit(0);
}
else {
switch (result.code) {
case kAuthV4ConflictPlayer:
// Account conflict
break;
case kAuthV4HelperImplifiedLoginFail:
// Implicit login failed
// ex) [HIVEAuthV4 showSignIn:^(HIVEResultAPI *result, HIVEPlayerInfo *playerInfo) {
// // do something...
// }];
break;
default:
// Other exceptions
break;
}
}
}];
Implicit login behavior: Mobile¶
Implicit login on mobile (such as Hive SDK Unity Android for Android/iOS platforms) (AuthV4.Helper.signIn
) prompts the user with a dialog asking whether to log in with the last logged-in account in case of an account conflict when logging in with a different account after the initial login.
Implicit login behavior: PC¶
Implicit login on PC (Windows platforms like Hive SDK Unity Windows) (AuthV4.Helper.signIn
) automatically logs in with the last logged-in account when logging in with a different account after the first login. Account conflicts do not occur.
Explicit login¶
Explicit login refers to the process where a user selects the IdP to authenticate. If both automatic login and implicit login fail, implement explicit login to be performed when the user clicks on the title after moving to the game title screen.
The explicit login UI can either use the UI provided by the Hive SDK or be customized using the IdP list returned as a result after the Hive SDK initialization is complete. If you are customizing the UI, please refer to the Explicit Login Customizing section.
The IdP list is controlled and provided by the Hive platform according to the policies of each country. For example, in China, Google Play games and Facebook, as well as guests, are not provided.
Explicit login screenshot¶
IdP selection UI provided by the SDK
When implementing using the UI provided by the SDK¶
To implement explicit login using the UI provided by the SDK, you can simply call the showSignIn()
method to invoke the IdP list UI.
Note
If the user closes the IdP selection UI provided by the SDK by pressing the 'X' button, a means to log in again must be provided. The user is still not logged in.
Note
To customize explicit sign-in, please refer to the following.
API Reference: hive.AuthV4.showSignIn
// Hive SDK AuthV4 authentication UI request
AuthV4.showSignIn((ResultAPI result, AuthV4.PlayerInfo playerInfo)=>{
if (result.isSuccess()) {
// Authentication successful
// playerInfo : Authenticated user information
// Example of retrieving email information
foreach (KeyValuePair<AuthV4.ProviderType, AuthV4.ProviderInfo> entry in playerInfo.providerInfoData) {
AuthV4.ProviderInfo providerInfo = entry.Value;
if(providerInfo.providerEmail != null && providerInfo.providerEmail != "") {
string email = providerInfo.providerEmail;
break;
}
}
}
else if (result.needExit()) {
// TODO: Implement the app exit feature
// e.g.) Application.Quit();
}
});
#include "HiveAuthV4.h"
// Hive SDK AuthV4 authentication UI request
FHiveAuthV4::ShowSignIn(FHiveAuthV4OnSignInDelegate::CreateLambda([this](const FHiveResultAPI& Result, const FHivePlayerInfo& PlayerInfo) {
if (Result.IsSuccess()) {
// Authentication successful (PlayerInfo: authenticated user information)
// Example of retrieving email information
for (const auto& ProviderInfoEntry : PlayerInfo.ProviderInfoData) {
FHiveProviderInfo ProviderInfo = ProviderInfoEntry.Value;
FString Email = ProviderInfo.ProviderEmail;
}
} else if (Result.NeedExit()) {
// TODO: Implement app exit functionality
// Example) UKismetSystemLibrary::QuitGame(GetWorld(), nullptr, EQuitPreference::Quit, false);
}
}));
API Reference: AuthV4::showSignIn
// Hive SDK AuthV4 authentication UI request
AuthV4::showSignIn([=](ResultAPI const & result, PlayerInfo const & playerInfo) {
if (result.isSuccess()) {
// Authentication successful
// playerInfo: Authenticated user information
// Example of retrieving email information
for(auto it = playerInfo.providerInfoData.begin(); it != playerInfo.providerInfoData.end(); ++it) {
hive::ProviderInfo providerInfo = it->second;
if(!providerInfo.providerEmail.empty()) {
std::string email = providerInfo.providerEmail;
break;
}
}
}
else if (result.needExit()) {
// TODO: Implement app exit functionality
// For Cocos2d-x engine users
// Example) exit(0);
// For Unreal engine users
// Example) UKismetSystemLibrary::QuitGame(GetWorld(), nullptr, EQuitPreference::Quit, false);
}
});
API Reference: com.hive.AuthV4.showSignIn
// Hive SDK AuthV4 authentication UI request
AuthV4.showSignIn(object : AuthV4.AuthV4SignInListener {
override fun onAuthV4SignIn(result: ResultAPI, playerInfo: AuthV4.PlayerInfo?) {
if (result.isSuccess) {
// Authentication successful
// playerInfo: Authenticated user information
// Example of retrieving email information
playerInfo?.let {
for ((key, value) in it.providerInfoData) {
var providerInfo: AuthV4.ProviderInfo = value
if(providerInfo.providerEmail.isNotEmpty()) {
val email = providerInfo.providerEmail
break
}
}
}
} else if (result.needExit()) {
// TODO: Implement app exit functionality
// e.g.) exitProcess(0)
}
}
})
API Reference: com.hive.AuthV4.showSignIn
// Hive SDK AuthV4 authentication UI request
AuthV4.showSignIn(new AuthV4.AuthV4SignInListener() {
@Override
public void onAuthV4SignIn(ResultAPI result, AuthV4.PlayerInfo playerInfo) {
if (result.isSuccess()) {
// Authentication successful
// playerInfo: authenticated user information
// Example of retrieving email information
if(playerInfo != null) {
for (Map.Entry<AuthV4.ProviderType, AuthV4.ProviderInfo> entry : playerInfo.getProviderInfoData().entrySet()) {
AuthV4.ProviderInfo providerInfo = entry.getValue();
if (providerInfo.getProviderEmail() != "") {
String email = providerInfo.getProviderEmail();
break;
}
}
}
}
else if (result.needExit()) {
// TODO: Implement app exit functionality
// Example) System.exit(0);
}
}
});
API Reference: HIVEAuthV4:showSignIn
var email = String()
// Hive SDK AuthV4 authentication UI request
AuthV4Interface.showSignIn { (result, playerInfo) in
if result.isSuccess() {
// Authentication successful
// playerInfo: Authenticated user information
// Example of retrieving email information
if let playerInfo = playerInfo {
// Searching for providerInfo with providerEmail (currently logged-in provider)
for key in playerInfo.providerInfoData.keys {
if let providerInfo = playerInfo.providerInfoData[key],
providerInfo.providerEmail.count > 0 {
// providerEmail != ""
email = providerInfo.providerEmail
break
}
}
}
} else if result.needExit() {
// TODO: Implement app exit functionality
// Example) exit(0)
}
}
API Reference: HIVEAuthV4:showSignIn
__block NSString* email = @"";
// Hive SDK AuthV4 authentication UI request
[HIVEAuthV4 showSignIn:^(HIVEResultAPI *result, HIVEPlayerInfo *playerInfo) {
if([result isSuccess]){
// Authentication successful
// playerInfo: Authenticated user information
// Example of retrieving email information
if(playerInfo != nil) {
// Searching for providerInfo with providerEmail (currently logged in provider)
for (NSString* key in playerInfo.providerInfoData.allKeys) {
HIVEProviderInfo* providerInfo = playerInfo.providerInfoData[key];
if (providerInfo != nil && providerInfo.providerEmail.length > 0) {
// providerEmail != ""
email = providerInfo.providerEmail;
break;
}
}
}
} else if ([result needExit]) {
// TODO: Implement app exit functionality
// e.g. exit(0);
}
}];
Explicit login customization¶
The customizable UI for explicit login can be implemented using providerTypeList
. The providerTypeList
is the response callback handler returned when calling the AuthV4.setup()
method for the purpose of initializing the Hive SDK, or when calling the AuthV4.Helper.getIDPList()
method after initialization. This feature is used when you want to display the login screen according to the game UI or primarily expose integration with specific IdPs. After implementing the customizable UI, call the signIn()
method with the desired ProviderType based on the user's action to implement the login.
Note
- When creating a login button, you must refer to the design guidelines provided by each IdP.
- Game Center: No separate regulations
- Google Play Games: Branding Guidelines
- Google: Branding Guidelines
- Hive Membership: Hive BI Guidelines
- Facebook: Brand Resource Center
- QQ: Policies and Regulations
- WeChat: Primary brand & Guidelines
- VK: VK Brandbook
- Apple: Human Interface Guidelines
- LINE: LINE Login Button Design Guidelines
- Huawei: HUAWEI ID Icon Specifications
- Steam: Steam Branding Guidelines
- X: X Brand toolkit
- It is important to comply with the Google Sign-in button guidelines for Google Featured.
- For the multilingual login button names applied to Hive authentication, please refer to here.
- UI example screenshot showing only the Facebook integration button on the login screen
The following is an example source code assuming a situation where the user selects Google login in a customized explicit login UI.
API Reference: hive.AuthV4.signIn
using hive;
AuthV4.signIn(AuthV4.ProviderType.GOOGLE, (ResultAPI result, AuthV4.PlayerInfo playerInfo) => {
if (result.isSuccess()) {
// Call successful
// playerInfo : authenticated user information.
// Example of retrieving email information for ProviderType.GOOGLE
Dictionary<AuthV4.ProviderType, AuthV4.ProviderInfo> providerInfoData = playerInfo.providerInfoData;
AuthV4.ProviderInfo providerInfo = providerInfoData[AuthV4.ProviderType.GOOGLE];
string email = providerInfo.providerEmail;
}
});
#include "HiveAuthV4.h"
FHiveAuthV4::SignIn(EHiveProviderType::GOOGLE,
FHiveAuthV4OnSignInDelegate::CreateLambda([this](const FHiveResultAPI& Result, const FHivePlayerInfo& PlayerInfo) {
if (Result.IsSuccess()) {
// Call succeeded (PlayerInfo: authenticated user information)
// Example of retrieving email information for EHiveProviderType::GOOGLE
TMap<EHiveProviderType, FHiveProviderInfo> ProviderInfoData = PlayerInfo.ProviderInfoData;
if (const FHiveProviderInfo* ProviderInfo = ProviderInfoData.Find(EHiveProviderType::GOOGLE)) {
FString Email = ProviderInfo->ProviderEmail;
}
}
}));
API Reference: Auth4::signIn
#include <HIVE_SDK_Plugin/HIVE_CPP.h>
AuthV4::signIn(ProviderType::GOOGLE, [=](ResultAPI const & result, PlayerInfo const & playerInfo) {
if (result.isSuccess()) {
// Call successful
// playerInfo : Authenticated user information.
// Example of retrieving email information for ProviderType::GOOGLE
map<ProviderType, ProviderInfo> providerInfoData = playerInfo.providerInfoData;
ProviderInfo providerInfo = providerInfoData[ProviderType::GOOGLE];
string email = providerInfo.providerEmail;
}
});
API Reference: AuthV4.signIn
import com.hive.AuthV4
import com.hive.ResultAPI
AuthV4.signIn(AuthV4.ProviderType.GOOGLE, object : AuthV4.AuthV4SignInListener {
override fun onAuthV4SignIn(result: ResultAPI, playerInfo: AuthV4.PlayerInfo?) {
if (result.isSuccess) {
// Call succeeded
// playerInfo: Authenticated user information
// Example of retrieving email information for ProviderType.GOOGLE
if (playerInfo != null) {
val providerInfoData = playerInfo.providerInfoData
val providerInfo = providerInfoData[AuthV4.ProviderType.GOOGLE]
if (providerInfo != null) {
val email = providerInfo.providerEmail
}
}
}
}
})
API Reference: com.hive.Auth4.signIn
import com.hive.AuthV4;
import com.hive.ResultAPI;
AuthV4.INSTANCE.signIn(AuthV4.ProviderType.GOOGLE, (result, playerInfo) -> {
if (result.isSuccess()) {
// Call successful
// playerInfo: authenticated user information
// Example of retrieving email information for ProviderType.GOOGLE
if (playerInfo != null) {
HashMap<AuthV4.ProviderType, AuthV4.ProviderInfo> providerInfoData = playerInfo.getProviderInfoData();
AuthV4.ProviderInfo providerInfo = providerInfoData.get(AuthV4.ProviderType.GOOGLE);
if (providerInfo != null) {
String email = providerInfo.getProviderEmail();
}
}
}
});
API Reference: AuthV4Interface.signIn
import HIVEService
AuthV4Interface.signIn(.Google) { result, playerInfo in
if result.isSuccess() {
// Call successful
// playerInfo: Authenticated user information.
// Example of retrieving Google email information
if
let playerInfo = playerInfo,
let providerInfo = playerInfo.providerInfoData["GOOGLE"] {
let email = providerInfo.providerEmail
}
}
}
API Reference: HIVEAuth4:signIn
#import <HIVEService/HIVEService-Swift.h>
[HIVEAuthV4 signIn:HIVEProviderTypeGoogle handler:^(HIVEResultAPI *result, HIVEPlayerInfo *playerInfo) {
if ([result isSuccess]){
// Call succeeded
// playerInfo: Authenticated user information.
// Example of retrieving email information for HIVEProviderTypeGoogle
if(playerInfo != nil) {
HIVEProviderInfo *providerInfo = playerInfo.providerInfoData[@"GOOGLE"];
if(providerInfo != nil){
NSString *email = providerInfo.providerEmail;
}
}
}
}];
Check IdP account logged in on device¶
Automatic login uses only the authentication token key of the saved PlayerID, while explicit login logs into accounts linked to multiple IdPs. In both cases, the IdP account of the logged-in PlayerID may differ from the IdP account logged into the actual device (DevicePlayer). Guidance will be provided to unify the two accounts in preparation for future achievements or leaderboard usage.
Here is an example code to check IdP information.
API Reference: AuthV4.Helper.syncAccount
using hive;
AuthV4.ProviderType providerType = AuthV4.ProviderType.GOOGLE;
AuthV4.Helper.syncAccount (providerType, delegate (ResultAPI result, AuthV4.PlayerInfo playerInfo) {
switch (result.code) {
case ResultAPI.Code.Success:
// Normal
break;
case ResultAPI.Code.AuthV4ConflictPlayer:
// Account conflict
// ex) When using Hive UI
// AuthV4.Helper.showConflict(...);
// or
// ex) When implementing GameUI
// AuthV4.Helper.resolverConflict(...);// When selecting current user
// AuthV4.Helper.switchAccount(...);// When selecting user switch
break;
default:
// Other exceptions
break;
}
});
#include "HiveAuthV4.h"
FHiveAuthV4::Helper::SyncAccount(ProviderType, FHiveAuthV4HelperDelegate::CreateLambda([this](const FHiveResultAPI& Result, const TOptional<FHivePlayerInfo>& PlayerInfo) {
switch (Result.Code) {
case FHiveResultAPI::ECode::Success:
// Normal response
break;
case FHiveResultAPI::ECode::AuthV4ConflictPlayer:
// Account conflict
// ex) When using Hive UI
// FHiveAuthV4::Helper::ShowConflict()
// ex) When implementing Game UI
// FHiveAuthV4::Helper::ResolveConflict() // Current user selection
// FHiveAuthV4::Helper::SwitchAccount() // User switch selection
break;
default:
// Other exceptional situations
break;
}
}));
API Reference: AuthV4::Helper::syncAccount
#include <HIVE_SDK_Plugin/HIVE_CPP.h>
using namespace std;
using namespace hive;
ProviderType providerType = ProviderType::GOOGLE;
AuthV4::Helper::syncAccount(providerType, [=](ResultAPI const & result, shared_ptr<PlayerInfo> playerInfo) {
switch (result.code) {
case ResultAPI::Success:
// Normal
break;
case ResultAPI::AuthV4ConflictPlayer:
// Account conflict
// ex) When using Hive UI
// AuthV4::Helper::showConflict(...);
// or
// ex) When implementing GameUI
// AuthV4::Helper::resolverConflict(...);// When selecting the current user
// AuthV4::Helper::switchAccount(...);// When selecting to switch user
break;
default:
// Other exceptions
break;
}
});
API Reference: AuthV4.Helper.syncAccount
import com.hive.AuthV4
import com.hive.ResultAPI
val providerType = AuthV4.ProviderType.GOOGLE
AuthV4.Helper.syncAccount(providerType, object : AuthV4.Helper.AuthV4HelperListener {
override fun onAuthV4Helper(result: ResultAPI, playerInfo: AuthV4.PlayerInfo?) {
when (result.code) {
ResultAPI.Code.Success -> {
// Normal
}
ResultAPI.Code.AuthV4ConflictPlayer -> {
// Account conflict
// ex) When using Hive UI
// AuthV4.Helper.showConflict(...);
// or
// ex) When implementing GameUI
// AuthV4.Helper.resolverConflict(...);// When selecting current user
// AuthV4.Helper.switchAccount(...);// When selecting user switch
}
else -> {
// Other exceptions
}
}
}
})
API Reference: AuthV4.Helper.INSTANCE.syncAccount
import com.hive.AuthV4;
import com.hive.ResultAPI;
AuthV4.ProviderType providerType = AuthV4.ProviderType.GOOGLE;
AuthV4.Helper.INSTANCE.syncAccount(providerType, (result, playerInfo) -> {
switch (result.getCode()) {
case Success:
// Normal
break;
case AuthV4ConflictPlayer:
// Account conflict
// ex) When using Hive UI
// AuthV4.Helper.INSTANCE.showConflict(...);
// or
// ex) When implementing GameUI
// AuthV4.Helper.INSTANCE.resolverConflict(...);// When selecting current user
// AuthV4.Helper.INSTANCE.switchAccount(...);// When selecting user switch
break;
default:
// Other exceptions
break;
}
});
API Reference: AuthV4Interface.helper().syncAccount
import HIVEService
let providerType: ProviderType = .Google
AuthV4Interface.helper().syncAccount(providerType) { result, playerInfo in
switch result.getCode() {
case .success:
// Normal
case .authV4ConflictPlayer:
// Account conflict
// ex) When using Hive UI
// AuthV4Interface.helper().showConflict(...);
// or
// ex) When implementing GameUI
// AuthV4Interface.helper().resolverConflict(...);// When selecting current user
// AuthV4Interface.helper().switchAccount(...);// When selecting user switch
default:
// Other exceptions
break
}
}
API Reference: [HIVEAuthV4 helper] syncAccount
#import <HIVEService/HIVEService-Swift.h>
HIVEProviderType providerType = HIVEProviderTypeGoogle
[[HIVEAuthV4 helper] syncAccount: providerType handler: ^(HIVEResultAPI *result, HIVEPlayerInfo *playerInfo) {
switch ([result getCode]) {
case HIVEResultAPICodeSuccess:
// Success
break;
case HIVEResultAPICodeAuthV4ConflictPlayer:
// Account conflict
// ex) When using Hive UI
// [[HIVEAuthV4 helper] showConflict: ...];
// or
// ex) When implementing GameUI
// [[HIVEAuthV4 helper] resolverConflict:...];// When selecting current user
// [[HIVEAuthV4 helper] switchAccount:...];// When selecting user switch
break;
default:
// Other exceptions
break;
}
}];
Guest Login¶
The guest login feature allows users to play the game in guest mode without selecting an IdP. Guests can be selected from the explicit login UI provided by the Hive SDK, or if customized directly in the game, guest login can also be implemented. The Windows environment does not support guest login.
When logging in as a guest, you must adhere to the following policies.
Guest login policy¶
- Implement the game so that both IdP authenticated users and guest users can use it in the same way. Even when logging in as a guest, most features of the Hive platform can be utilized. Therefore, please ensure that users logged in as guests can use the game in the same way as IdP linked users. For example, guest users should also be able to purchase items and make payments within the game.
- Do not provide a logout function for guest users. If a user logs out after logging in as a guest, they will no longer be able to log in with the same PlayerID. Therefore, when a user is logged in as a guest, do not provide a logout button to prevent them from logging out.
- Prohibition of guest login policy in China When using a Chinese IP, only users who have undergone real-name authentication can recharge and consume resources (effective from May 1, 2017), so guest logins are not included in the list of IdPs that can log in with a Chinese IP.
To perform guest login, call the signIn()
method with ProviderType.GUEST
as a parameter.
Here is an example code for performing guest login.
Note
The PlayerID in a guest state without any IdP authentication does not have providerInfoData in playerInfo.
API Reference: hive.AuthV4.signIn
API Reference: Auth4::signIn
API Reference: AuthV4.signIn
import com.hive.AuthV4
import com.hive.ResultAPI
AuthV4.signIn(AuthV4.ProviderType.GUEST, object : AuthV4.AuthV4SignInListener {
override fun onAuthV4SignIn(result: ResultAPI, playerInfo: AuthV4.PlayerInfo?) {
if (result.isSuccess) {
// Authentication successful
// playerInfo: Authenticated user information
}
}
})
API Reference: com.hive.Auth4.signIn
API Reference: AuthV4Interface.signIn
API Reference: HIVEAuth4:signIn
Custom login¶
Custom login is a feature that allows you to implement login with an IdP integrated with the game itself, in addition to the IdP provided by Hive. Try creating an authentication key (authKey) to use when calling the custom login API according to Authenticate v4 Custom Authentication.
After calling the custom login API, you can access the customProviderInfoData
data through the instance of the PlayerInfo class received as a callback to check the information of the custom logged-in user. The ProviderType (enum) of customProviderInfoData
is set to CUSTOM
uniformly, and it can be distinguished in detail by the ProviderName (String).
The information of the IdP that implemented custom login in the game is not included in the results of calling the setup()
and showSignIn()
methods of the AuthV4
class.
If you have received
playerId
andplayerToken
after the first execution of the custom login, the Result API ofauthV4SessionExist(code)
will be delivered as a callback when the custom login API is recalled. In this case, you should callsignIn()
withProviderType.Auto
as a parameter to proceed with automatic login using the already logged-in account. Please refer to the example code below.The
connect()
anddisconnect()
methods of theAuthV4
class do not support additional integration and disconnection of custom login IdP. Additional integration and disconnection of custom login IdP are supported by theconnectWithAuthKey()
anddisconnectWithName()
methods.
This is an example code for implementing custom login.
API Reference: hive.AuthV4.signIn
// Twitter login implemented directly in the game
Game.Login("CUSTOM_TWITTER", (string authKey) => {
AuthV4.signInWithAuthKey(authKey, (ResultAPI result, PlayerInfo playerInfo) => {
if (result.isSuccess()) {
Dictionary<string, ProviderInfo> customProviderInfoData = playerInfo.customProviderInfoData;
ProviderInfo providerInfo = customProviderInfoData["CUSTOM_TWITTER"];
// Check the following user linkage information
providerInfo.providerType; // ProviderType.CUSTOM, custom types are fixed so need to distinguish by providerName
providerInfo.providerName; // "CUSTOM_TWITTER"
providerInfo.providerUserId; // User id used for the directly implemented Twitter login
return;
}
else if (result.code == ResultAPI.Code.AuthV4SessionExist) {
// If playerId and playerToken have already been issued and automatic login is needed
// TODO: AuthV4.signIn(ProviderType.AUTO, (ResultAPI _result, PlayerInfo playerInfo) => {});
}
else if (result.code == ResultAPI.Code.AuthV4NotInitialized) {
// TODO: SDK initialization needed
}
else if (result.code == ResultAPI.Code.AuthV4InvalidParam) {
// TODO: Check if the value of the provided authKey is NULL or empty
}
else if (result.needExit()) {
// TODO: Implement app exit functionality
// e.g. Application.Quit();
}
});
});
#include "HiveAuthV4.h"
// Implemented Twitter login directly in the game with "CUSTOM_TWITTER" type
void GameLogin(const FString& AuthKey)
{
FHiveAuthV4::SignInWithAuthKey(AuthKey, FHiveAuthV4OnSignInDelegate::CreateLambda([this](const FHiveResultAPI& Result, const FHivePlayerInfo& PlayerInfo) {
if (Result.IsSuccess()) {
TMap<FString, FHiveProviderInfo> CustomProviderInfoData = PlayerInfo.CustomProviderInfoData;
if (const FHiveProviderInfo* ProviderInfo = CustomProviderInfoData.Find(TEXT("CUSTOM_TWITTER"))) {
EHiveProviderType ProviderType = ProviderInfo->ProviderType; // EHiveProviderType::CUSTOM, custom types have fixed Type
FString ProviderName = ProviderInfo->ProviderName; // Need to distinguish by ProviderName
FString ProviderUserId = ProviderInfo->ProviderUserId; // User id used in the custom Twitter login
}
} else if (Result.NeedExit()) {
// TODO: Implement app exit functionality
// e.g.) UKismetSystemLibrary::QuitGame(GetWorld(), nullptr, EQuitPreference::Quit, false);
} else if (Result.Code == FHiveResultAPI::ECode::AuthV4SessionExist) {
// If playerId and playerToken have already been issued and automatic login is needed
// TODO: FHiveAuthV4.SignIn(EHiveProviderType::GUEST, Delegate);
} else if (Result.Code == FHiveResultAPI::ECode::AuthV4NotInitialized) {
// TODO: SDK initialization needed
} else if (Result.Code == FHiveResultAPI::ECode::AuthV4InvalidParam) {
// TODO: Check if the value of the provided authKey is empty
}
}));
}
API Reference: Auth4::signIn
using namespace std;
using namespace hive;
// Twitter login implemented directly in the game
Game::Login("CUSTOM_TWITTER", [=](string authKey) {
AuthV4::signInWithAuthKey(authKey, [=](ResultAPI const & result, PlayerInfo const & playerInfo) {
if (result.isSuccess()) {
map<string, ProviderInfo> customProviderInfoData = playerInfo.customProviderInfoData;
ProviderInfo providerInfo = customProviderInfoData["CUSTOM_TWITTER"];
// Check the following user linkage information
providerInfo.providerType; // ProviderType::CUSTOM, custom types are fixed, so need to distinguish by providerName
providerInfo.providerName; // "CUSTOM_TWITTER"
providerInfo.providerUserId; // User id used for the custom Twitter login
return;
}
else if (result.code == ResultAPI::Code::AuthV4SessionExist) {
// If playerId and playerToken have already been issued and automatic login is needed
// TODO: AuthV4.signIn(ProviderType::AUTO, [=](ResultAPI const & _result, PlayerInfo const & playerInfo) {});
}
else if (result.code == ResultAPI::Code::AuthV4NotInitialized) {
// TODO: SDK initialization needed
}
else if (result.code == ResultAPI::Code::AuthV4InvalidParam) {
// TODO: Check if the value of the provided authKey is NULL or empty
}
else if (result.needExit()) {
// TODO: Implement app exit functionality
// For Cocos2d-x engine users
// Example) exit(0);
// For Unreal engine users
// Example) UKismetSystemLibrary::QuitGame(GetWorld(), nullptr, EQuitPreference::Quit, false);
}
});
});
API Reference: com.hive.Auth4.signIn
// Twitter login implemented directly in the game
Game.Login("CUSTOM_TWITTER") { authKey: String ->
AuthV4.signInWithAuthKey(authKey, object : AuthV4.AuthV4SignInListener {
override fun onAuthV4SignIn(result: ResultAPI, playerInfo: AuthV4.PlayerInfo?) {
if (result.isSuccess && playerInfo != null) {
playerInfo.customProviderInfoData["CUSTOM_TWITTER"]?.let { providerInfo ->
providerInfo.providerType // ProviderType.CUSTOM, custom types are fixed, so need to distinguish by providerName
providerInfo.providerName // "CUSTOM_TWITTER"
providerInfo.providerUserId // User id used for the custom Twitter login
}
}
else if (result.needExit()) {
// TODO: Implement app exit functionality
// e.g.) exitProcess(0)
}
else if (result.code == ResultAPI.Code.AuthV4SessionExist) {
// If playerId and playerToken have already been issued and automatic login is needed
// TODO: AuthV4.signIn(AuthV4.ProviderType.AUTO, authV4SignInListener)
}
else if (result.code == ResultAPI.Code.AuthV4NotInitialized) {
// TODO: SDK initialization required
}
else if (result.code == ResultAPI.Code.AuthV4InvalidParam) {
// TODO: Check if the value of the provided authKey is NULL or empty
}
}
})
}
API Reference: com.hive.Auth4.signIn
// Twitter login implemented directly in the game
Game.Login("CUSTOM_TWITTER") { authKey: String ->
AuthV4.INSTANCE.signInWithAuthKey(authKey, new AuthV4.AuthV4SignInListener() {
@Override
public void onAuthV4SignIn(@NonNull ResultAPI result, @Nullable AuthV4.PlayerInfo playerInfo) {
if(result.isSuccess() && playerInfo != null) {
HashMap<String, AuthV4.ProviderInfo> customProviderInfoData = playerInfo.getCustomProviderInfoData();
AuthV4.ProviderInfo providerInfo = customProviderInfoData.get("CUSTOM_TWITTER");
// Check the following user linkage information
if (providerInfo != null){
providerInfo.getProviderType(); // AuthV4.ProviderType.CUSTOM, custom types are fixed by Type so need to distinguish by providerName
providerInfo.getProviderName(); // "CUSTOM_TWITTER"
providerInfo.getProviderUserId(); // User id used in the custom Twitter login
}
} else if (result.needExit()) {
// TODO: Implement app exit functionality
// e.g.) System.exit(0);
} else if (result.getCode() == ResultAPI.Code.AuthV4SessionExist) {
// If playerId and playerToken have already been issued and automatic login is needed
// TODO: AuthV4.signIn(AuthV4.ProviderType.AUTO, authV4SignInListener)
} else if (result.getCode() == ResultAPI.Code.AuthV4NotInitialized) {
// TODO: SDK initialization needed
} else if (result.getCode() == ResultAPI.Code.AuthV4InvalidParam) {
// TODO: Check if the value of the provided authKey is NULL or empty
}
}
});
}
API Reference: HIVEAuth4:signIn
// Twitter login implemented directly in the game
Game.login("CUSTOM_TWITTER") { (authKey) in
AuthV4Interface.signInWithAuthKey(authKey) { (result, playerInfo) in
if result.isSuccess() {
let customProviderInfoData = playerInfo?.customProviderInfoData;
let providerInfo = customProviderInfoData?["CUSTOM_TWITTER"]
// Check the following user linkage information
providerInfo?.providerType; // AuthProviderType, custom types are fixed so need to distinguish by providerName
providerInfo?.providerName; // "CUSTOM_TWITTER"
providerInfo?.providerUserId; // User id used for the custom Twitter login
return
}
else if result.getCode() == .authV4SessionExist {
// If playerId and playerToken have already been issued and auto-login is needed
// TODO: AuthV4Interface.signIn(.auto) { (result, playerInfo) in }
}
else if result.getCode() == .authV4NotInitialized {
// TODO: SDK initialization needed
}
else if result.getCode() == .authV4invalidParam {
// TODO: Check if the value of the provided authKey is nil or empty
}
else if result.needExit() {
// TODO: Implement app exit functionality.
// Example) exit(0)
}
}
}
API Reference: HIVEAuth4:signIn
// Directly implemented Twitter login in the game
[Game login:@"CUSTOM_TWITTER" handler:^(NSString* authKey) {
[HIVEAuthV4 signInWithAuthKey:authKey handler:^(HIVEResultAPI* result, HIVEPlayerInfo* playerInfo) {
if (result.isSuccess) {
NSDictionary<NSString*, HIVEProviderInfo*>* customProviderInfoData = playerInfo.customProviderInfoData;
ProviderInfo* providerInfo = [customProviderInfoData objectForKey:@"CUSTOM_TWITTER"];
// Check the following user linkage information
providerInfo.providerType; // HIVEProviderTypeCustom, custom types are fixed, so need to distinguish by providerName
providerInfo.providerName; // "CUSTOM_TWITTER"
providerInfo.providerUserId; // User id used for the custom Twitter login
return;
}
else if (result.getCode == HIVEResultAPICodeAuthV4SessionExist) {
// If playerId and playerToken have already been issued and automatic login is needed
// TODO: [HIVEAuthV4 signIn:HIVEProviderTypeAuto, handler:^(HIVEResultAPI* _result, HIVEPlayerInfo* playerInfo) {}];
}
else if (result.getCode == HIVEResultAPICodeAuthV4NotInitialized) {
// TODO: SDK initialization needed
}
else if (result.getCode == HIVEResultAPICodeAuthV4InvalidParam) {
// TODO: Check if the value of the provided authKey is NULL or empty
}
else if (result.needExit) {
// TODO: Implement app exit functionality.
// e.g.) exit(0);
}
}];
}];
Username¶
Due to issues such as COPPA in the United States, when accessing from the United States and its territories and logging in as an IdP, you must enter a username to enable additional user identification authentication processing. For reference, the countries included in the U.S. territories are American Samoa (AS), Guam (GU), Northern Mariana Islands (MP), Puerto Rico (PR), U.S. Minor Outlying Islands (UM), and U.S. Virgin Islands (VI). The screen for entering the username for user identification is as follows.
- The username input screen is used only for user identification purposes, so it is displayed only once during the initial IdP integration and will not be displayed thereafter.
- The username input screen is not displayed during guest login.
Verification of authentication token key¶
The game server can verify the validity of the authentication token key using the Token, playerId, and DID information returned after a successful login. Hive authentication allows multi-device login and concurrent access.
If duplicate access with the same account is not allowed, the game server will display a notification message on the device that connected first, then terminate the game, and ensure that the game is maintained on the device that connects later. In this case, if duplicate access occurs without terminating the game, the game play records may not be reflected correctly. To implement this feature, you need to manage a validated token key or manage the session key of the game itself using it.
Please refer to the Authentication Token Key Validation Server API to implement this feature.
Obtaining the TalkPlus login token¶
After completing signIn()
through the authentication v4 interface, use the AuthV4.getHiveTalkPlusLoginToken API to obtain the login token, which is used for logging into Hive TalkPlus.
Note
For related guidance, please refer to the Hive TalkPlus Login Guide.
Detecting IdP account changes in the background¶
Users can navigate to device settings during gameplay to change their Apple Game Center or Google Play game accounts. If you need to check whether the IdP account during gameplay differs from the IdP account associated with the current PlayerID, call setProviderChangedListener()
after initializing the SDK. By calling this API, you will receive an event indicating that the IdP account set on the device has changed when the game resumes.
iOS operates when the Apple Game Center account is changed, and Android operates when the Google Play Games account is changed, and responses are delivered only if the currently logged-in PlayerID is linked to that IdP. When receiving an IdP account change event, the UI is configured to allow the user to choose whether to use the IdP account logged in on the device. If the user selects the IdP account logged in on the device, signOut
is called to log out, and then implicit login is performed.
Warning
Devices that installed Google Play games released after July 2021 cannot change IdP accounts in the background due to operational issues with Google Play games.
Note
This feature may cause game play to be interrupted and request account changes, and it can only be used restrictively at times when account synchronization is required, such as entering the lobby or the shop.
The following is an example code that sets up to receive an event when the user restarts the game and the IdP account set on the device has changed.
API Reference: hive.AuthV4.setProviderChangedListener
#include "HiveAuthV4.h"
FHiveAuthV4::SetProviderChangedListener(FHiveAuthV4OnCheckProviderDelegate::CreateLambda([this](const FHiveResultAPI& Result, const FHiveProviderInfo& ProviderInfo) {
if (Result.IsSuccess()) {
// Call succeeded. Check the changed user information through the ProviderInfo object
}
}));
API Reference: AuthV4::setProviderChangedListener
#include <HIVE_SDK_Plugin/HIVE_CPP.h>
using namespace std;
using namespace hive;
AuthV4::setProviderChangedListener([=](ResultAPI const & result, ProviderInfo const & providerInfo) {
if (!result.isSuccess()) {
return;
}
if (providerInfo != null && providerInfo.providerType == ProviderType::GOOGLE) {
// Change Google Play Game Service account
}
});
API Reference: AuthV4.setProviderChangedListener
import com.hive.AuthV4
import com.hive.ResultAPI
AuthV4.setProviderChangedListener(object : AuthV4.AuthV4CheckProviderListener {
override fun onDeviceProviderInfo(result: ResultAPI, providerInfo: AuthV4.ProviderInfo?) {
if (!result.isSuccess) {
return
}
if (providerInfo != null && providerInfo.providerType == AuthV4.ProviderType.GOOGLE) {
// Change Google Play Game Service account
}
}
})
API Reference: com.hive.AuthV4.setProviderChangedListener
API Reference: AuthV4Interface.setProviderChangedListener
API Reference: HIVEAuthV4:setProviderChangedListener
Game data initialization¶
Do not call logout when initializing game data. Since PlayerID is not deleted, conflicts between accounts may occur. You should implement it so that the user can continue playing with the currently logged-in account, and do not call logout until the user explicitly requests it.
Logout¶
Warning
- When logging out, the authentication information PlayerId and session information PlayerToken, as well as all IDP session information, will be deleted.
- Values set by all APIs starting with set will not be initialized or deleted.
- All methods starting with set in the Configuration, Auth, Auth v4, Promotion, and Push classes
- The following are representative examples. ex> Configuration.setServer, Configuration.setUseLog, Configuration.setGameLanguage, Configuration.setHiveCertificationKey, Auth.setEmergencyMode, AuthV4.setProviderChangedListener, Promotion.setUserEngagementReady, Promotion.setAddtionalInfo, Push.setRemotePush, Push.setForegroundPush, etc. All methods starting with set fall under this category.
- Starting from Hive SDK v4 24.3.0, an error code is returned when a guest user logs out. After that, the client and server sessions are maintained.
- The validity scope of values set through methods starting with set in the SDK is maintained within the app's lifecycle, regardless of the login or logout status.
If you have logged into Hive, the PlayerID and authentication token key have been issued. Logging out is the function that initializes the PlayerID and authentication token key. When you call the signOut()
method to complete the logout, you will be redirected to the game title, and explicit login will be performed when you click on the title.
Note
- When logging out in guest login status, the same PlayerID can no longer be found, so please implement it so that logout is not provided in guest status.
- The IdP linkage status of the PlayerID does not change even after logging out.
- Once the logout is complete, it will navigate to the game title, and explicit login will be performed when clicking the title.
- After logging out, implicit login will be performed first when restarting the app.
Here is an example code that performs logout.
API Reference: hive.AuthV4.signOut
#include "HiveAuthV4.h"
FHiveAuthV4::Helper::SignOut(FHiveAuthV4HelperDelegate::CreateLambda([this](const FHiveResultAPI& Result, const TOptional<FHivePlayerInfo>& PlayerInfo) {
AHIVESDKV4TesterGameMode::getGameModeInstance()->appendLogString(ELogType::AuthV4Helper ,TEXT("Helper::SignOut Result = %s"), *(Result.ToString()));
switch (Result.Code) {
case FHiveResultAPI::ECode::Success:
// Logout successful
break;
default:
// Other exceptions
break;
}
}));
API Reference: AuthV4::signOut
API Reference: AuthV4.Helper.signOut
import com.hive.AuthV4
import com.hive.ResultAPI
AuthV4.Helper.signOut(object : AuthV4.Helper.AuthV4HelperListener {
override fun onAuthV4Helper(result: ResultAPI, playerInfo: AuthV4.PlayerInfo?) {
when (result.code) {
ResultAPI.Code.Success -> {
// Logout successful
}
else -> {
// Other exception cases
}
}
}
})
API Reference: AuthV4.Helper.INSTANCE.signOut
API Reference: AuthV4Interface.helper().signOut()
API Reference: [HIVEAuthV4 helper] signOut
Game Center cancellation notice text¶
Language | Phrase |
---|---|
Korean | Apple Game Center login has been canceled. Please log in at [Settings > Game Center] to sync with your Game Center account and try again. |
English | Your login to the Game Center has been canceled. Log in at [Settings> Game Center] to sync to the Game Center Account and try again. |
Japanese | Apple Game Center ログインがキャンセルされました。 Game Center アカウントと連動するには [設定 > Game Center] にログインした後、再度お試しください。 |
Simplified Chinese | Apple Game Center has logged out. If you want to sync with the Game Center account, please log in again in [Settings>Game Center] on your device and try again. |
Traditional Chinese | 登入Apple Game Center已取消。 若想連動Game Center帳號,請至[設定 > Game Center]登入後,再試一次。 |
French | Ta connexion au Game Center a été annulée. Connecte-toi dans [Réglages > Game Center] pour synchroniser ton compte Game Center et essaie de nouveau. |
German | Das Einloggen ins Apple Game Center wurde abgebrochen. Die Synchronisation mit dem Game Center-Konto läuft über [Einstellungen > Game Center]. Logge dich ein und versuche es erneut. |
Russian | Ваш авторизация в Game Center была отменена. Авторизуйтесь в Game Center через [Настройки > Game Center] и повторите попытку. |
Spanish | Tu Inicio de Sesión en Game Center ha sido cancelado. Inicia Sesión en [Configuración>Game Center] para sincronizar a la Cuenta de Game Center, e inténtalo de nuevo. |
Portuguese | O seu login no Game Center foi cancelado. Faça o login em [Configurações>Game Center] para sincronizar com a Conta do Game Center e tente novamente. |
Indonesian | Login ke Apple Game Center telah dibatalkan. Hubungkan akun Game Center dengan login di [Pengaturan > Game Center] dan coba lagi. |
Malaysian | Log masuk ke Game Center anda telah dibatalkan. Log masuk di [Tetapan>Game Center] untuk disegerakkan ke Akaun Game Center dan cuba lagi. |
Vietnamese | Đã hủy bỏ đăng nhập vào Apple Game Center. Đăng nhập tại [Cài đặt > Game Center] để đồng bộ với tài khoản Game Center và thử lại. |
Thai | การล็อกอินเข้า Game Center ของคุณถูกยกเลิก ล็อกอินที่ [การตั้งค่า>Game Center] เพื่อเชื่อมต่อบัญชี Game Center และโปรดลองอีกครั้ง |
Italian | L'accesso all'Apple Game Center è stato annullato. Fai log-in su [Impostazioni > Game Center] per sincronizzare il tuo account con il Game Center e riprova. |
Turkish | Apple Oyun Merkezine girişiniz iptal edilmiştir. Oyun Merkezi Hesabına ulaşmak için [Ayarlar>Oyun Merkezi]'nden giriş yapın ve tekrar deneyin. |
Arabic | تم إلغاء تسجيل الدخول إلى مركز الألعاب. سجل الدخول إلى [الإعدادات> مركز الألعاب] للمزامنة مع حساب مركز الألعاب وحاول مرة أخرى. |