Skip to content

Issue custom authentication key

Issues the authentication key required to link a custom IdP (Identity Provider) in the app.

The 'Issue custom authentication key' API operates through Server-to-Server communication, where the app server calls the Hive authentication server directly. When the call succeeds, the custom authentication key is returned in the response's data.custom_auth_key field. You can use this key to newly link an IdP or link an IdP to a Player ID.


Request URL

Production URL https://auth.qpyou.cn/v2/game/customauth/get-key
Sandbox URL https://sandbox-auth.qpyou.cn/v2/game/customauth/get-key
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_id String value of the IdP String Y
idp_user_id User ID value provided by the IdP String Y
auth_type Purpose of the custom authentication key
SIGNINIDP: New IdP linking and authentication
CONNECT: Link an IdP to a Player ID
String Y
player_id User Player ID BigInteger N (Required when calling the API with auth_type set to CONNECT)
Note

Among the fields, the idp_id value must be written in one of the designated string formats shown in the examples below.

  • CUSTOM_FIREBASE
  • CUSTOM_FACEBOOK
  • CUSTOM_GOOGLE
  • CUSTOM_SIGNIN_APPLE
  • CUSTOM_TWITTER
  • CUSTOM_NAVER
  • CUSTOM_GAME


Response body

Field name Description Type
result_code Response code Details Integer
result_msg Response 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 Response data Object
data.custom_auth_key Custom authentication key String

Response code

Code value Description
0 Success
1005 Unsupported auth_type
2499 JWT validation failed (see token_validation)
4200 Unsupported IdP


Request example

{
    "appid": "com.com2us.hivesdk.normal.freefull.apple.global.ios.universal",
    "idp_id": "CUSTOM_TWITTER",
    "idp_user_id": "1204273895139753984",
    "auth_type": "SIGNINIDP",
    "player_id": 10012038880
}


Response example

Success

{
    "result_code": 0,
    "result_msg": "SUCCESS",
    "token_validation": {
        "result_code": 0,
        "result_msg": "success"
    },
    "data": {
        "custom_auth_key": "f28ac8415716f438b9c972e3706c0dab"
    }
}

JWT validation failure

{
    "result_code": 2499,
    "result_msg": "JWT validation failed. See token_validation for details.",
    "token_validation": {
        "result_code": 2408,
        "result_msg": "The access token is expired. Please refresh your token."
    }
}
Note

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