カスタムWebログイン実装
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.
Warning
カスタムWebログインAPIは、ゲスト(GUEST、idp_index: 0)アカウントの作成をサポートしていません。
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検証エラーコードを参照してください。