TikTok for Developers

Developer Docs

Last updated October 5, 2026

Login and Authorization

The Login API provides a temporary code that your game server exchanges for an access token. Never store the client secret in the mini game frontend.

The Authorization API lets you request user authorization for specific scopes such as user profile, contact list, or other protected resources.

TT.Login(success, fail)

Initiates the TikTok login flow and returns a temporary code through the success callback. Send this code to your game server to complete the token exchange.

Signature

public static void Login(Action<string> success, Action<string> fail)

Parameters

Field

Type

Description

Required

success

Action<string>

Success callback receiving a temporary login code

Yes

fail

Action<string>

Failure callback receiving an error message

No

Example

if (!CanIUse.Login)
{
    Debug.LogError("Login is not available in the current runtime.");
    return;
}

TT.Login(
    code =>
    {
        // Send the temporary code to your game server
        Debug.Log($"Login code: {code}");
    },
    errMsg =>
    {
        Debug.LogError($"Login failed: {errMsg}");
    });

TT.Authorize(param)

Requests user authorization for the specified scope. The authorization result is delivered through callbacks.

Signature

public static void Authorize(AuthorizeParam param)

Parameters

Field

Type

Description

Required

scope

string

Authorization scope (e.g., user.info, mobile.number)

Yes

Success

Action<AuthorizeResult>

Success callback

No

Fail

Action<ErrorInfo>

Failure callback

No

Complete

Action

Completion callback

No

Example

TT.Authorize(new AuthorizeParam
{
    scope = "user.info",
    Success = result => Debug.Log("Authorization granted"),
    Fail = error => Debug.LogError(error.ErrMsg),
    Complete = () => Debug.Log("Authorization flow completed")
});
TikTok for Developers