跳轉至

透過認證 API 查詢使用者資訊

Request this API when user information must be checked separately after web login is completed.

This API operates by server-to-server communication from the app server directly to the Hive authentication server. It returns user information for the IdP using appid, idp_index, and idp_user_id from the response of the Login verification and user information retrieval API.


請求 URL

正式 URL https://auth.qpyou.cn/v2/game/player/get-playerid
分散式環境 URL https://auth.globalwithhive.com/v2/game/player/get-playerid
沙盒 URL https://sandbox-auth.qpyou.cn/v2/game/player/get-playerid
HTTP 方法 POST
Content-Type application/json
資料格式 JSON
Note

The Hive authentication server is configured as a distributed environment in preparation for failures or network communication issues.
If communication with the authentication server host fails or exceeds the timeout defined on the app server, the app server must directly call the distributed environment URL (Fallback URL).


請求標頭

欄位名稱 說明 類型 必填
X-Access-Token 用於應用程式伺服器認證的 OAuth 2.0 Access Token
(請參閱 發行 OAuth Token
String Y
ISCRYPT 資料是否加密(0 = 不加密)(必須傳遞 0) Integer Y


請求本文

欄位名稱 說明 類型 必填
appid App ID String Y
idp_index IdP index IdP list Integer Y
idp_user_id Unique IdP identifier String Y


請求範例

{"appid":"com.com2us.hivesdk.normal.freefull.apple.global.ios.universal","idp_index":1,"idp_user_id":"68101398"}


回應本文

欄位名稱 說明 類型
result_code 回應代碼 詳情 Integer
result_msg 結果訊息 String
token_validation JWT 驗證結果(JWT 驗證錯誤 Object
token_validation.result_code JWT 驗證結果代碼 Integer
token_validation.result_msg JWT 驗證結果訊息 String
data 結果資料 Object
data.enc_idp Key that encrypts Request Body information String
data.player_id Player ID BigInteger
data.list Linked IdP list Array
data.list[].seq Linked IdP list - Seq BigInteger
data.list[].player_id Linked IdP list - Player ID BigInteger
data.list[].idp_user_id Linked IdP list - unique IdP identifier String
data.list[].idp_index Linked IdP list - IdP index IdP list Integer
data.list[].idp_id Linked IdP list - IdP ID String
data.is_blocked Whether use is suspended Boolean
data.is_refund Whether the refunded user is subject to repayment Boolean

回應代碼

Code value 說明
0 成功
2002 No user data
2499 JWT 驗證失敗(請參閱 token_validation)
4000 Invalid request parameter


回應範例

成功 (user information exists)

{"result_code":0,"result_msg":"SUCCESS","token_validation":{"result_code":0,"result_msg":"success"},"data":{"enc_idp":"K+A4xduO7kf5OrJ/iDPqL0PtMxwu7wW8JSBO+JJwSDDmJLvIi/6LG7TyWXdEHr9RNHM+/QXwc0+Y9z2eSRg7oeBBHmpOajzF1iiaacbFom4CsNy2fItendset7T0i0WYdyLQih3z5mDjcct47+gg2ovbp6kWRY8D+aGq+ZgaKiyr0Hmb1xmbWY/7cl1FjXTm0Nl9CWhO418bJFdwOpi+bw==","player_id":20000016588,"list":[{"seq":25771,"player_id":20000016588,"idp_user_id":"68101398","idp_index":1,"idp_id":"HIVE"},{"seq":25772,"player_id":20000016588,"idp_user_id":"0","idp_index":0,"idp_id":"GUEST"}],"is_blocked":false,"is_refund":false}}

成功 (no user information)

{"result_code":2002,"result_msg":"No User","token_validation":{"result_code":0,"result_msg":"success"},"data":{"enc_idp":"K+A4xduO7kf5OrJ/iDPqLyCHfP+L3wz0WTNVw5KHLCqYjqQ+shQ2P3mkgwYCMvlnPatzlSE5ZFINr5gEIxK14sg0N8kOPSjSCeQ9UGGt11OMrYsGTuys0KmPJ2ZU/UWVVxpP1Lxx1eS8VbYwLmoTG+HTw2vkocghs/ZOZ9rqisdBRprhp6Q6+lIjpaUzDa2yy2guM1WheuVzKGL5331HHgo557RqoyUzTc6Lkf8ArWZ/XSwi3ZmStmhz/U4thcIwiowqgV+Ecdb2+WmMZ1MgGT4Xvbxa4lqzToBC3nxDvi1d8TjgMaszVYoNct94WPBGvV6emg3GqiJG+0ZTGg53+mZad9ttkUpTnQXetz5UDTxe5NnFAYfffzBq3jkqfAB042eH21rE3uTVJq3HuO8i9t1LJwKFfkC7sjjuaKNWsjs="}}

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."
  }
}

失敗

{"result_code":4000,"result_msg":"Request has invalid format.","data":"appid, idp_user_id, idp_index"}
Note

JWT 驗證失敗時,可在 token_validation 欄位中查看詳細錯誤資訊。詳情請參閱 JWT 驗證錯誤代碼