Skip to content

Usage restriction

Method

GetBlockStatusAsync

To block users who violated your operating policy from entering the app, call GetBlockStatusAsync() to check whether the currently logged-in user is restricted. If the user is sanctioned, the sanction type, the sanction period, and the notice message to show to the user are returned together.

Registering and releasing sanctioned users is handled only in Usage restriction in the Hive Console. The app only retrieves the restriction status. Implement the screen that shows the notice message and blocks entry to the app based on the result yourself in the app client.

The restriction status is delivered as data in a success response, not as an error. The method call itself succeeds even if the user is sanctioned, so check the Data.IsBlocked value to decide whether to allow entry.

Call this method right after the session is registered through login, just before the user enters the main screens of the app. This method identifies the user with the access token of the current session, so no separate request values are needed.

Note

You can also tell whether the user is sanctioned from Data.IsBlock in the login response. However, the login response does not contain the sanction type, period, or notice message, so to tell the user the reason, you must call this method.

Call parameters

Field name Type Required Description
context ApiCallContext Optional Per-call settings object. If omitted, the default values are used.

Call example

AuthGetBlockStatusResult, the object returned by GetBlockStatusAsync(), is divided into success, Outcomes (feature-specific results), and Failure (the call could not be completed). This method does not throw exceptions and delivers every processing result through the returned object, so branch with a switch statement instead of try/catch.

using Hive.Axyl.Auth;
using Hive.Axyl.Core;
using UnityEngine;

IAuthService auth = HiveCore.Resolve<IAuthService>();

AuthGetBlockStatusResult result = await auth.GetBlockStatusAsync();

switch (result)
{
    case AuthGetBlockStatusResult.Success success when success.Data.IsBlocked:
        // Sanctioned user → show the notice message as is and block entry to the app.
        BlockDetail block = success.Data.Block;
        bool isPermanent = block.EndAt == null;
        Debug.LogWarning($"Usage restriction: {block.Name} / Permanent: {isPermanent}");
        ShowBlockPopup(block.Message);
        break;

    case AuthGetBlockStatusResult.Success:
        // No restriction → continue entering the app.
        break;

    // Handle common failures (network and server errors)
    case AuthGetBlockStatusResult.Failure failure:
        HiveError err = failure.Problem;
        Debug.LogError($"[{err.Code}] {err.Message} (trace: {err.TraceId})");
        break;

    // Safety net: unhandled results and unknown new results (UnknownOutcome)
    default:
        Debug.LogWarning($"Unhandled result: {result.GetType().Name}");
        break;
}

Response data

On success, Data of AuthGetBlockStatusResult.Success contains the result.

Variable name Type Required Description
Data.IsBlocked bool Required Whether the user is restricted. If true, Data.Block contains the details.
Data.Block BlockDetail Optional Usage restriction details. null if there is no restriction.

BlockDetail

Variable name Type Required Description
Code int Required Restriction type code in the range 100-999. It is the same value as the code registered in Restriction types in the Hive Console.
Name string Required Restriction type name
Message string Required Notice message to show to the user. It contains the message requested in the device language or in the language specified with SetLanguage. If the message for that language is empty or the app does not support the language, it contains the message in the app's default language. The app client shows the received value as is.
StartAt DateTimeOffset Required Restriction start time, in UTC.
EndAt DateTimeOffset? Optional Restriction end time, in UTC. null means a permanent restriction.

Response example

// No restriction
// success.Data.IsBlocked = false
// success.Data.Block     = null

// Restriction for a period
// success.Data.IsBlocked = true
// success.Data.Block.Code    = 101
// success.Data.Block.Name    = "Abusive Language"
// success.Data.Block.Message = "욕설 사용으로 7일간 이용이 제한되었습니다."
// success.Data.Block.StartAt = 2026-04-01T09:00:00+00:00
// success.Data.Block.EndAt   = 2026-04-08T09:00:00+00:00

// Permanent restriction
// success.Data.IsBlocked = true
// success.Data.Block.Code    = 102
// success.Data.Block.Name    = "Permanent Ban"
// success.Data.Block.Message = "계정이 영구적으로 제한되었습니다."
// success.Data.Block.StartAt = 2026-04-01T09:00:00+00:00
// success.Data.Block.EndAt   = null

Response status

The returned AuthGetBlockStatusResult object branches into one of the following cases. The restriction status is not a separate case; it is delivered as the Data.IsBlocked value of Success.

Response case Description App client handling
Success Retrieval succeeded. Data.IsBlocked and Data.Block contain the restriction status and details. Allow or block entry according to the Data.IsBlocked value
BlockTypeNotFound When the restriction type information cannot be found Check the registration status of restriction types in the console
BlockTypeContentNotFound When the restriction type exists but the notice message in the default language cannot be found Check whether the default language notice message is entered for the restriction type in the console
AppNotFound · TerminateService When the app information cannot be found or the app's service has been terminated Check the App ID registration status and the service operation status in the console
AppIdMismatch · InvalidGatewayContext When the App ID of the request differs from the project of the authentication token, or the authentication context is invalid Check the App ID used for SDK initialization and the session state
UnknownOutcome A new result that this SDK version does not know Log it and handle it conservatively
Failure Common Failure. Missing required parameters or format errors (invalid_parameter), missing required fields (missing_field), and a missing X-App-Id header (missing_app_id) also branch here, and the cause is contained in Failure.Problem.ExternalCode. See Common error handling. Handle it according to the common error handling guidelines