Skip to main content
TikTok for Developers


Login Kit with Swift

There is a new version of this SDK: Login Kit for iOS


This guide explains how to integrate with Login Kit for iOS using Swift. Once authenticated users authorize your app, you can access their basic TikTok profile data including their display name and avatar. Additional data access may require approval for additional Scopes. Learn more on Scopes Overview.


Obtain a client key and client secret by logging in to Developer Portal and selecting your app. Refer to the Quickstart Guide for detailed steps.

iOS Integration

Authorization Request

  1. Create a TikTokOpenSDKAuthRequest and set permissions equal to the set of scopes you are requesting from the user. For example,,video.list.
  2. Send the authorization request.
  3. If user authorization was successful, a code will be provided in the response.
  4. Upload this code to your server-side and obtain a user access token. See Manage User Access Tokens for more information.

These steps are demonstrated in the following code snippet:

import TikTokOpenSDK

/* STEP 1: Create the request and set permissions */
let scopes = ",video.list" // list your scopes
let scopesSet = NSOrderedSet(array:scopes)
let request = TikTokOpenSDKAuthRequest()
request.permissions = scopesSet

/* STEP 2: Send the request */
request.send(self, completion: { resp -> Void in
    /* STEP 3: Parse and handle the response */
    if resp.errCode == 0 {
        let responseCode = resp.code
        // Upload response code to your server and obtain user access token
    } else {
        // User authorization failed. Handle errors

Handling Errors

See Error Codes for error handling and debugging.