Integrating QQ Account

This topic explains how to allow your users to sign up and log in with their QQ accounts. All you need to do is add a configuration value via the dev portal and add a few line of code to your app!

Configuring QQ Integration

Create a QQ App

To get started, first create a QQ application and get your QQ App ID. Please refer to the official guide for detailed instructions.

Configuring a Kii application

Please perform the following steps in the developer portal to configure your application to set your QQ App ID.

  1. Click on the "Edit" button in your application console in the developer portal.


  3. Click "QQ" to open the configuration screen for QQ.

  4. Enter your QQ App ID and click SAVE.

Getting a QQ Access Token

Your application must get the QQ access token by itself. See this document for more details.

Login with a QQ Account

Here is an example for allowing a new user to login with their QQ account. Put the QQ access token and OpenID in {ACCESS_TOKEN_PROVIDED_BY_QQ} and {OPENID_PROVIDED_BY_QQ}, respectively.

curl -v -X POST \
  -H "Authorization: Basic {BASE64_ENCODED_APPID_AND_APPKEY}" \
  -H "Content-Type: application/vnd.kii.AuthTokenQQRequest+json" \
  "{APP_ID}/integration/qq" \
  -d '{
    "accessToken": "{ACCESS_TOKEN_PROVIDED_BY_QQ}",

You log in with Basic Authentication. Replace {BASE64_ENCODED_APPID_AND_APPKEY} with a Base64-encoded string of concatenated AppID and an arbitrary value with a colon (:) in between the two values.

Once the user's identity has been verified with QQ, Kii Cloud will check if the user is a new or existing in your application. If it is a new user, Kii Cloud will automatically create a new account.

Upon successful sign-up/login, Kii Cloud will return an access token for the user along with this users User ID and the expiration time of the token in UNIX time (msec):

< HTTP/1.1 200 OK
< Content-Type: application/json;charset=UTF-8
  "id" : "{USER_ID}",
  "access_token" : "{ACCESS_TOKEN}",
  "expires_in" : 9223372036854775,
  "token_type" : "bearer",
  "new_user_created": true

The new_user_created key will be set to true if Kii Cloud performed a registration for the new user.

Linking a Kii Account to a QQ Account

By linking QQ accounts, your users will be able to log in with their QQ accounts in addition to using their existing passwords.

curl -v -X POST \
  -H "Authorization: Bearer {ACCESS_TOKEN}" \
  -H "Content-Type: application/vnd.kii.LinkQQRequest+json" \
  "{APP_ID}/users/me/qq/link" \
  -d '{
    "accessToken": "{ACCESS_TOKEN_PROVIDED_BY_QQ}",

If successful, Kii Cloud will respond as shown below:

< HTTP/1.1 204 No Content

Unlinking a Kii Account from a QQ Account

You can unlink existing users from their QQ accounts in the following manner:

curl -v -X POST \
  -H "Authorization: Bearer {ACCESS_TOKEN}" \
  "{APP_ID}/users/me/qq/unlink" \
  -d ""

If successful, Kii Cloud will respond as shown below:

< HTTP/1.1 204 No Content