Skip to main content
Version: v3

Basic TapTap User Verification

If you only wish to use TapTap as a login method and do not wish to use any other TDS cloud services, reference this document. Note: If you only select TapTap Login, choosing other cloud services at a later time may result in an upgrade fee.

Getting the SDK

Integrating the basic TapTap Login requires the TapLogin and TapCommon modules. Please first download the TapSDK and add the corresponding dependencies.

Initialization

TapLogin.Init(string clientID, bool isCn, bool roundCorner);

Parameter Summary

ParameterDescription
clientIDDetermines an app's corresponding Client ID in the TapTap Developer Center
isCnDepends on the applicable region. true for mainland China, false for International
roundCornerDetermines if the web page border is rounded when logging in. Rounded=true, straight=false

TapTap Login and Retrieving Login Results

tip

After the user opens the game, the game can check the login status of the user. If there is already a user logged in, the game can let the user proceed to the game without having to manually log in again.

try
{
// On iOS and Android, the SDK will call the TapTap app or WebView to initiate login.
// On Windows and macOS, the SDK will display a QR code (default) and a jump link (to be configured).
var accessToken = await TapLogin.Login();
Debug.Log($"TapTap Login Complete accessToken: {accessToken.ToJson()}");
}
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");
}
}
}

// Fetch TapTap Profile to obtain basic user info, such as their nickname and avatar.
var profile = await TapLogin.FetchProfile();
Debug.Log($"TapTap Login Complete 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.

This information is under fair use for developers.

See TapTap OAuth Interface.

Check Login Status and User Info

Login status and user info are saved in the local cache, which resets after logging in again. Logging out will clear the cache.

// Obtain login status
try
{
var accesstoken = await TapLogin.GetAccessToken();
Debug.Log("Logged in");
// Enter game directly
}
catch (Exception e)
{
Debug.Log("Not logged in");
// Start login
}

// Obtain user info
await TapLogin.GetProfile();

// Obtain real-time user info
await TapLogin.FetchProfile();

Log Out

TapLogin.Logout();

PC Login Configurations

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 require additional configuration.

Upgrading to TDS Authentication

As mentioned above, if preliminary development only requires TapTap Login as a third-party interface but requires TDS Authentication services later, this will incur a development fee. Details are as follows:

  1. Reference the above guide on Initialization and Quick Log-in With TapTap to complete TapTap Login for TDS Authentication to obtain a TDSUser login.

  2. Obtain the authorized user's Profile info. Note: The Profile info here must be the same as the Profile previously obtained from the game. Game developers should be able to use this to find the persistent player data saved on the game server. Otherwise, they can bind the current TDSUser with the original player info. As for the game, developers can decide whether to bind TDSUser with player accounts:

    • TapSDK doesn't require binding because it saves the cached login status internally. Get currentUser when necessary to retrieve the previous TDS login status.
    • Binding simplifies the process and allows you to expand TDS account info to more third-party platforms.