Logout practical guide
To implement logout in your app, you must combine Hive Axyl SDK calls, recipe code calls, and app code. With the recipe code, the logout request and the in-memory session cleanup come down to a single method.
Implementation scope
The work required to implement logout starts with connecting the logout button and ends with cleaning up the automatic login information saved on the device and returning to the login screen.
The work in each step falls into one of the following four categories.
| Category | Owner | Description |
|---|---|---|
| Hive Console | App operator | Settings you configure in the Hive Console. |
| Hive Axyl SDK | App developer | Hive Axyl SDK methods the app calls. |
| Recipe code | App developer | Recipe methods the app calls. |
| App code | App developer | Parts the app implements directly without going through Hive Axyl. |
The Hive Console is used only in the prerequisites. The logout feature itself has no separate console settings, and there are no store plugin calls or Hive Axyl Server API calls. For the meaning of the parameters and the response fields, see the detailed procedure linked in each step.
Recipe
The Hive Axyl SDK provides the logout feature as fine-grained methods. The method that requests logout from the server, the method that deletes the in-memory session, and the method that deletes the tokens saved on the device are all separate. The app must also decide by itself what to delete for each result.
A recipe is source code that completes that combination in advance. Instead of installing it as a package, you copy it into your project.
| Category | Location | Characteristics |
|---|---|---|
| Hive Axyl SDK | Unity package com.com2usplatform.hiveaxyl.* | You install and use it. It provides authentication features as fine-grained methods. |
| Recipe | Assets/Recipes/Logout/ | You copy and use it. Plain C# code that groups SDK calls by purpose. |
| Usage example | Assets/RecipeExamples/Authentication/LogoutExample.cs | Code you read for reference. Its comments explain the recipe call order and the parts the app must implement for each result. |
Recipes are code you copy and use
Recipes are copied into your app and become your app's code. You can use them as is or modify them to fit your app's policies.
What the app implements
The recipe handles only the logout request and the in-memory session cleanup on the app's behalf. The app implements the following items outside the recipe.
- The logout button and cancellation handling
- Deleting the automatic login information saved on the device
- The transition to the login screen
- User-facing messages and logging for each result
Common prerequisites
Before you start implementing, prepare the following items.
| Item to prepare | Required | Category | Where to check |
|---|---|---|---|
| Create a project | Required | Hive Console | Create a project |
| Create an App ID | Required | Hive Console | Create an App ID |
| Connect the SDK to your Unity project | Required | Hive Axyl SDK | Connect the SDK to your Unity project |
| Logged-in user | Required | Recipe code | Guest login practical guide, Username login practical guide |
The recipe works only when there is an active session. If you call it without logging in, it fails with a FailedPrecondition error, so display the logout button only to logged-in users.
Next steps
Once you have completed the prerequisites, start Implement logout.