การใช้งานเว็บล็อกอินแบบกำหนดเอง This guide explains how to implement web login directly using the Hive server API instead of the web login page provided by Hive Platform. Refer to this document when the app needs its own login UI and direct IdP authentication handling.
Note To use the custom web login API, app registration and OAuth 2.0 Access Token issuance must be completed in Hive Console.
Overview Use custom web login in the following cases.
When you want to apply an app-specific login UI/UX When you want to implement a login screen consistent with the existing website design When you want to process login within your own page without redirecting to the web login page
IdP sign-in Creates a new player with IdP information or returns existing player information if the IdP is already registered. When sign-in succeeds, check the PlayerID in data.player_id.
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 account deletion, set it to false.
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 code (IdP list ) Integer Y idp_user_id Unique IdP user identifier String Y require_token Whether to request a player token. true when using Delete account , otherwise false Boolean Y
ตัวอย่างคำขอ { "appid" : "com.com2us.hivesdk.normal.freefull.apple.global.ios.universal" , "idp_index" : 3 , "idp_user_id" : "google_67890" , "require_token" : true }
ชื่อฟิลด์ คำอธิบาย ประเภท Authorization Session token. Used when calling Delete account API String
เนื้อหาการตอบกลับ ชื่อฟิลด์ คำอธิบาย ประเภท result_code รหัสตอบกลับ Details Integer result_msg ข้อความผลลัพธ์ String token_validation ผลการตรวจสอบ JWT (ข้อผิดพลาดการตรวจสอบ JWT ) Object token_validation.result_code รหัสผลการตรวจสอบ JWT Integer token_validation.result_msg ข้อความผลการตรวจสอบ JWT String data ข้อมูลผลลัพธ์ Object data.player_id Player ID Integer data.idp_index IdP index Integer data.idp_id IdP name String data.idp_user_id IdP user ID String
รหัสตอบกลับ Code value คำอธิบาย 0 สำเร็จ 2499 การตรวจสอบ JWT ล้มเหลว (ดู token_validation) 4200 IdP does not exist 5000 Internal server error
IdP linking Links a new IdP to an existing player account. You must call this API after signing in with the IdP sign-in API.
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 code (IdP list ) Integer Y idp_user_id Unique IdP user identifier String Y player_id Player ID to link Integer Y
ตัวอย่างคำขอ { "appid" : "com.com2us.hivesdk.normal.freefull.apple.global.ios.universal" , "idp_index" : 2 , "idp_user_id" : "fb_12345678" , "player_id" : 100000001 }
เนื้อหาการตอบกลับ ชื่อฟิลด์ คำอธิบาย ประเภท result_code รหัสตอบกลับ Details Integer result_msg ข้อความผลลัพธ์ String token_validation ผลการตรวจสอบ JWT (ข้อผิดพลาดการตรวจสอบ JWT ) Object token_validation.result_code รหัสผลการตรวจสอบ JWT Integer token_validation.result_msg ข้อความผลการตรวจสอบ JWT String data ข้อมูลผลลัพธ์ Object data.player_id Player ID Integer data.idp_index Linked IdP index Integer data.idp_id Linked IdP name String data.idp_user_id IdP user ID String
รหัสตอบกลับ Code value คำอธิบาย 0 สำเร็จ 1002 The IdP is already linked to another player 1003 The same IdP type is already linked 2002 Player does not exist 2499 การตรวจสอบ JWT ล้มเหลว (ดู token_validation) 4200 IdP does not exist 5000 Internal server error
IdP unlinking Unlinks an IdP from a player account. You must call this API after signing in with the IdP sign-in API.
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 code (IdP list ) Integer Y idp_user_id Unique IdP user identifier String Y player_id Player ID Integer Y
เนื้อหาการตอบกลับ ชื่อฟิลด์ คำอธิบาย ประเภท result_code รหัสตอบกลับ Details Integer result_msg ข้อความผลลัพธ์ String token_validation ผลการตรวจสอบ JWT (ข้อผิดพลาดการตรวจสอบ JWT ) Object token_validation.result_code รหัสผลการตรวจสอบ JWT Integer token_validation.result_msg ข้อความผลการตรวจสอบ JWT String
รหัสตอบกลับ Code value คำอธิบาย 0 สำเร็จ 2499 การตรวจสอบ JWT ล้มเหลว (ดู token_validation) 4006 Linked IdP information does not exist 4200 IdP does not exist 5000 Internal server error 7000 Invalid token
Delete account Deletes a player account. You must call this API after signing in with the IdP sign-in API.
Set require_token to true when calling the IdP sign-in API. Store the Authorization value returned in the response header. Include the stored Authorization value in the request header when calling this API. Warning Account deletion cannot be undone. Provide sufficient notice to the user before deletion.
URL คำขอ ส่วนหัวคำขอ ชื่อฟิลด์ คำอธิบาย ประเภท จำเป็น X-Access-Token OAuth 2.0 Access Token สำหรับการรับรองความถูกต้องของเซิร์ฟเวอร์แอป (ดู ออก OAuth Token ) String Y ISCRYPT ข้อมูลถูกเข้ารหัสหรือไม่ (0 = ไม่เข้ารหัส) (ต้องส่ง 0 เสมอ) Integer Y Authorization Session token received in the response header after calling IdP sign-in with require_token: true String Y
เนื้อหาคำขอ ชื่อฟิลด์ คำอธิบาย ประเภท จำเป็น appid App ID String Y player_id Player ID to delete Integer Y did Device ID. Fixed to 0 Integer Y
รหัสตอบกลับ Code value คำอธิบาย 0 สำเร็จ 2499 การตรวจสอบ JWT ล้มเหลว (ดู token_validation) 5000 Internal server error 7000 Invalid token 7001 No token in header
Note เมื่อการตรวจสอบ JWT ล้มเหลว คุณสามารถดูข้อมูลข้อผิดพลาดโดยละเอียดได้ในฟิลด์ token_validation โปรดดู รหัสข้อผิดพลาดการตรวจสอบ JWT สำหรับรายละเอียด