Skip to content

IdP account management

Creates and manages player accounts using IdP (Identity Provider) credential information.

The 'IdP account management' API operates through Server-to-Server communication, where the app server calls the Hive authentication server directly. It can be used for various purposes, including Player ID creation, login, IdP linking and unlinking, implementing login in a web environment, and migrating existing accounts.

Note

This API does not support user authentication or credential acquisition through external authentication providers such as Google, Meta, and Apple. Implement these processes directly in the app client and pass the results to the app server.

The APIs provided by the 'IdP account management' feature are as follows.

API Endpoint Description
POST /v2/game/auth/signinidp IdP login
POST /v2/game/auth/connect Link IdP
POST /v2/game/auth/disconnect Unlink IdP


IdP login

Creates a Player ID for a new player using IdP information, or returns existing player information if the IdP is already registered. When the IdP login request succeeds, you can check the generated Player ID in data.player_id.

Request URL

Production URL https://auth.qpyou.cn/v2/game/auth/signinidp
Sandbox URL https://sandbox-auth.qpyou.cn/v2/game/auth/signinidp
HTTP Method POST
Content-Type application/json
Data Format JSON

Request header

Field name Description Type Required
X-Access-Token OAuth 2.0 Access Token for game server authentication
(See Issue OAuth token)
String Y
ISCRYPT Whether data is encrypted (0 = not encrypted; always pass 0) Integer Y

Request body

Field name Description Type Required
appid App ID String Y
idp_index IdP index code. See IdP index reference Integer Y
idp_user_id IdP user unique identifier String Y
require_token Whether to request a player token. true when using the Delete account API; false when not using it Boolean Y
Note

To use the Delete account API, set require_token to true to receive the Authorization value in the response header. If you do not use the account deletion feature, set it to false.

Response header

Field name Description Type
Authorization Session token. Issued only when require_token: true String
Content-Type Response data format (JSON) and character encoding (UTF-8) information String
ISCRYPT Whether the response is encrypted Integer

Response body

Field name Description Type
result_code Response code Details Integer
result_msg Result message String
token_validation JWT validation result (JWT validation error) Object
token_validation.result_code JWT validation result code Integer
token_validation.result_msg JWT validation result message String
data.player_id PlayerID BigInteger
data.idp_index IdP index Integer
data.idp_id IdP name String
data.idp_user_id IdP user ID String

Response code

Code value Description
0 Success
2499 JWT validation failed (see token_validation)
4000 Invalid parameter
4001 Request JSON error
4200 Nonexistent IdP
5000 Internal server error
7000 Invalid token
7001 No token value in header

Request example

{
    "appid": "com.com2us.hivesdk.normal.freefull.apple.global.ios.universal",
    "idp_index": 3,
    "idp_user_id": "google_67890",
    "require_token": true
}

Response example

HTTP/1.1 200
Content-Type: application/json; charset=UTF-8
Authorization: abcdf7ebce779429ea878f91d5f1c8
ISCRYPT: 0

Success

{
    "result_code": 0,
    "result_msg": "SUCCESS",
    "token_validation": {
        "result_code": 0,
        "result_msg": "success"
    },
    "data": {
        "player_id": 100000002,
        "idp_index": 3,
        "idp_id": "GOOGLE",
        "idp_user_id": "google_67890"
    }
}


Link IdP

Links a new IdP to an existing player account. IdP linking is available only after a Player ID has been created.

Request URL

Production URL https://auth.qpyou.cn/v2/game/auth/connect
Sandbox URL https://sandbox-auth.qpyou.cn/v2/game/auth/connect
HTTP Method POST
Content-Type application/json
Data Format JSON

Request header

Field name Description Type Required
X-Access-Token OAuth 2.0 Access Token for game server authentication
(See Issue OAuth token)
String Y
ISCRYPT Whether data is encrypted (0 = not encrypted; always pass 0) Integer Y

Request body

Field name Description Type Required
appid App ID String Y
idp_index IdP index code. See IdP index reference Integer Y
idp_user_id IdP user unique identifier String Y
player_id PlayerID to link BigInteger Y

Response body

Field name Description Type
result_code Response code Details Integer
result_msg Result message String
token_validation JWT validation result (JWT validation error) Object
token_validation.result_code JWT validation result code Integer
token_validation.result_msg JWT validation result message String
data.player_id PlayerID BigInteger
data.idp_index Linked IdP index Integer
data.idp_id Linked IdP name String
data.idp_user_id IdP user ID String

Response code

Code value Description
0 Success
1002 This IdP is already linked to another player
1003 The same IdP type is already linked
2002 Nonexistent player
2499 JWT validation failed (see token_validation)
4000 Invalid parameter
4200 Nonexistent IdP
5000 Internal server error
7000 Invalid token
7001 No token value in header

Request example

{
    "appid": "com.com2us.hivesdk.normal.freefull.apple.global.ios.universal",
    "idp_index": 2,
    "idp_user_id": "fb_12345678",
    "player_id": 100000001
}

Response example

Success

{
    "result_code": 0,
    "result_msg": "SUCCESS",
    "token_validation": {
        "result_code": 0,
        "result_msg": "success"
    },
    "data": {
        "player_id": 100000001,
        "idp_index": 2,
        "idp_id": "FACEBOOK",
        "idp_user_id": "fb_12345678"
    }
}

Already linked to another player

{
    "result_code": 1002,
    "result_msg": "Already connected other player",
    "token_validation": {
        "result_code": 0,
        "result_msg": "success"
    },
    "data": {
        "player_id": 100000002,
        "idp_index": 2,
        "idp_id": "FACEBOOK",
        "idp_user_id": "fb_12345678"
    }
}


Unlink IdP

Unlinks an IdP linked to a player account. IdP unlinking is available only after a Player ID has been created.

Request URL

Production URL https://auth.qpyou.cn/v2/game/auth/disconnect
Sandbox URL https://sandbox-auth.qpyou.cn/v2/game/auth/disconnect
HTTP Method POST
Content-Type application/json
Data Format JSON

Request header

Field name Description Type Required
X-Access-Token OAuth 2.0 Access Token for game server authentication
(See Issue OAuth token)
String Y
ISCRYPT Whether data is encrypted (0 = not encrypted; always pass 0) Integer Y

Request body

Field name Description Type Required
appid App ID String Y
idp_index IdP index code. See IdP index reference Integer Y
idp_user_id IdP user unique identifier String Y
player_id PlayerID to unlink BigInteger Y

Response body

Field name Description Type
result_code Response code Details Integer
result_msg Result message String
token_validation JWT validation result (JWT validation error) Object
token_validation.result_code JWT validation result code Integer
token_validation.result_msg JWT validation result message String

Response code

Code value Description
0 Success
2499 JWT validation failed (see token_validation)
4000 Invalid parameter
4006 No linked IdP information
4200 Nonexistent IdP
7000 Invalid token
7001 No token value in header

Request example

{
    "appid": "com.com2us.hivesdk.normal.freefull.apple.global.ios.universal",
    "idp_index": 2,
    "idp_user_id": "fb_12345678",
    "player_id": 100000001
}

Response example

Success

{
    "result_code": 0,
    "result_msg": "SUCCESS",
    "token_validation": {
        "result_code": 0,
        "result_msg": "success"
    }
}
Note

When JWT validation fails, you can check detailed error information in the token_validation field. For details, see JWT validation error codes.