# Runtime

## Method Calls

* Auth.HandleAuthProcessAsync
* Auth.CancelAuthProcess
* Auth.CheckIfConnectedToMeshMapAccount
* Auth.DisconnectFromMeshMapAccount

## Events

* Auth.OnCodeGenerated
* Auth.OnCodeValidated
* Auth.OnAuthenticated
* Auth.OnAuthenticationCancelled
* Auth.OnAuthenticationFailed
* Auth.OnDisconnected

## Getting Started

The easiest way to get started is to import the **Auto and Scan Import** sample into your Unity project. Go to `Windows > Package Manager > MeshMap Unity SDK > Samples`.

Make sure to [configure your app API key in the MeshMap Hub](https://docs.meshmap.com/unity-sdk/core/..#api-key).

#### Features

* A simple user flow for MeshMap account login and logout.
  * Generates a 6-digit verification code to enter in the [MeshMap web app](https://app.meshmap.com/play). The player may be prompted to login or create a MeshMap account.
* Persistent authentication status using PlayerPrefs. Deleted on log out.

#### Components

<table><thead><tr><th width="226.00006103515625">Class</th><th>Description</th></tr></thead><tbody><tr><td><a href="https://github.com/MeshMap/com.meshmap.sdk.core/blob/main/Runtime/API/Auth/Auth.cs"><code>Auth</code></a></td><td>Handles user authentication flow, including code generation, validation polling, cancellation, and disconnecting a user session.</td></tr><tr><td><a href="https://github.com/MeshMap/com.meshmap.sdk.core/blob/main/Samples~/AuthAndScanImport/Scripts/Auth/LoginUI.cs"><code>LoginUI</code></a></td><td>Demonstrates the authentication UI logic for logging into a MeshMap account, including auth code generation, validation, cancellation, and feedback display.</td></tr><tr><td><a href="https://github.com/MeshMap/com.meshmap.sdk.core/blob/main/Samples~/AuthAndScanImport/Scripts/Auth/LogOutUI.cs"><code>LogoutUI</code></a></td><td>Demonstrates the logout process, including PlayerPrefs deletion, UI transitions, and event signaling.</td></tr></tbody></table>
