# 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](/unity-sdk/core.md#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>


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.meshmap.com/unity-sdk/core/auth/runtime.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
