Auth

class Auth(umami: Umami)

Provides authentication functionalities for interacting with the Umami API. This class handles user login, logout, and token verification.

Parameters

umami

The Umami instance used for making HTTP requests.

Constructors

Link copied to clipboard
constructor(umami: Umami)

Types

Link copied to clipboard
interface Login

Functions

Link copied to clipboard

Logs in a user with the provided Login.Request object. On successful login, the received JWT token is stored for subsequent authenticated requests.

suspend fun login(username: String, password: String): Auth.Login.Response

Logs in a user with the provided username and password. This function constructs a Login.Request and then calls the overloaded login function.

Link copied to clipboard
suspend fun logout()

Logs out the current user by sending a logout request to the Umami API and removing the authorization header.

Link copied to clipboard
suspend fun verify(): User

Verifies the current authentication token and retrieves the details of the logged-in user.