Skip to main content
Version: v3

Integrate TapTap Login

Integrate TapTap Login Methods:

  1. Integrate TapTap login via TDS Authentication System.
  2. Basic TapTap User Verification.

We recommend the first method for the following scenarios:

  • Integrating the account system provided by TapSDK.
  • Allowing players to bind additional third-party accounts to their account (Ex: QQ, WeChat, Apple).
  • Integrating basic TapSDK system functions in TDS Authentication such as Friends or Achievements.

Otherwise, if you already have an account system and do not plan on using TapSDK functions such as Friends or Achievements, you can integrate TapTap User Login via the second method.

We will introduce the first method and then the second method.

Both methods require visiting Developer Center > Game Services > Integrate Functions to activate TapTap Login.

Check Login Status

The SDK will save the user's login data in the local cache. When your game launches, you can retrieve the login data using the following code. This will allow the player to enter the game without having to log in. Cache will not automatically be cleared.

If the player logs out of the game or clears the game's cache, then the login info will also be deleted.

var currentUser = await TDSUser.GetCurrent();
if (null == currentUser)
{
Debug.Log("Not logged in");
// Start logging in
}
else
{
Debug.Log("Logged in");
// Enter the game
}

Quick Log-in With TapTap

Regarding TapTap User Login, TapSDK provides special support to developers with the fastest and most convenient integration.

You can call TDSUser.loginWithTapTap to log in with a press of a button. For example:

try
{
// On iOS and Android, the TapTap app will be called or WebView will be used to log in.
// On Windows and macOS, the SDK will display a QR code (default) and a jump link (to be configured).
var tdsUser = await TDSUser.LoginWithTapTap();
Debug.Log($"login sucess:{tdsUser}");
// Get properties of TDSUser
var objectId = tdsUser.ObjectId; // Unique ID
var nickname = tdsUser["nickname"]; // Nickname
var avatar = tdsUser["avatar"]; // Avatar
}
catch (Exception e)
{
if (e is TapException tapError) // using TapTap.Common
{
Debug.Log($"encounter exception:{tapError.code} message:{tapError.message}");
if (tapError.code == TapErrorCode.ERROR_CODE_BIND_CANCEL) // Cancel Login
{
Debug.Log("Login cancelled");
}
}
}

After calling the interface above, the TapTap client or a WebView will be opened up to start the log-in process. Once the user finishes authorizing, your app can use the result of the OAuth to finish logging in to the TDS account system.

TDSUser is the current user's account system. Upon logging in, developers can:

  • Visit objectId to obtain the user's system ID (the unique identifier), which can be used to bind or match the player on the game server with TDS Authentication.
  • Visit nickname properties to obtain the user's TapTap account name.
  • Visit avatar properties to obtain the TapTap account's avatar.

You can view and manage user accounts by going to the Developer Center.

Obtain User Details

Once TapTap user login is complete, developers can use the following methods to obtain information on TapTap authorization results:

var profile = await TapLogin.FetchProfile();
Debug.Log($"profile: {profile.ToJson()}");

Profile will contain the following info:

ParameterDescription
nameThe player's nickname on TapTap.
avatarThe URL of the player's profile picture on TapTap.
openidA unique identifier generated from the user's profile and the game's information. Each player has a unique openid in each game.
unionidA unique identifier generated from the user's profile and the vendor's information. A player has the same unionid for all the games made by the same vendor, but different ones for different vendors.
emailThe email used by the user to register TapTap
emailVerifiedWhether the email used by the user to register TapTap is verified

openid and unionid are Base64-encoded strings (with padding) containing characters from A-Za-z0-9+/=.

info

Since unionid is strongly associated with the vendor, if your game gets transferred to a different vendor, the unionid of the users will get changed.

If your game depends on unionid, our technical support staff will have a discussion with you regarding how the data should be handled so the game will still work properly after being transferred.

User Logout

Players can easily log out by calling logOut.

await TDSUser.Logout();

PC Login Configurations

tip

Unity SDK 3.5.2 onwards on Windows and macOS supports using a QR code or jump link for players to access the TapTap login page.

SDK supports QR scanning to log in by default.

Jump links must be configured. See below for examples:

PC Login

Windows

Using a jump link on Windows requires filling out the following configurations in the Registry:

Windows Registry Editor Version 5.00

[HKEY_CLASSES_ROOT\open-taptap-{client_id}]
@="{Game Name}"
"URL Protocol"="{Program.exe installation path}}"

[HKEY_CLASSES_ROOT\open-taptap-{client_id}]
@="{Game Name}"

[HKEY_CLASSES_ROOT\open-taptap-{client_id}]

[HKEY_CLASSES_ROOT\open-taptap-{client_id}\Shell\Open]

[HKEY_CLASSES_ROOT\open-taptap-{client_id}\Shell\Open\Command]
@="\"{Program.exe installation path}\" \"%1\""

macOS

On macOS, SDK will automatically configure CFBundleURLTypes.

Use the following steps to configure without errors:

  • On Unity, open BuildSetting and select PC, Mac & Linux Standalone Platform. In Target Platform, select macOS.
  • Check Create XCode Project, select XCode to compile.
  • Open output XCode Project, select Target, click Info, open URL Types, inspect whether you have input the URL Scheme: TapWeb : open-taptap-{clientId}. If not, then enter:
<key>CFBundleURLTypes</key>
<array>
<dict>
<key>CFBundleURLName</key>
<string>TapWeb</string>
<key>CFBundleURLSchemes</key>
<array>
<string>open-taptap-{client_id}</string>
</array>
</dict>
</array>

Additional Functions

View the TDS Authentication Guide for info on the other functions of TDS Authorization.

Video Tutorials

You can refer to the video tutorial:How to Integrate TapTap Login Functionality in Games to learn how to access login functionality in Untiy projects.

For more video tutorials, see Developer Academy. As the SDK features are constantly being improved, there may be inconsistencies between the video tutorials and the new SDK features, so the current documentation should prevail.