# Minekube accounts

> A Minekube account is a Minecraft: Java Edition account - you prove it by joining the Minekube hub, which Mojang checks, and mk login turns the hub's one-time code into a session - and an account owns networks.

> **Preview: Connect in the Minekube plugin:**
> This page describes networks in the Minekube plugin, the next generation of Connect. Today's Connect plugin and its `<endpoint>.play.minekube.net` addresses are described in the [Connect docs](https://minekube.com/guide/) and keep working. [Networks in the Minekube plugin](https://minekube.com/guide/networks/) compares the two.

A Minekube account is a Minecraft: Java Edition account: its UUID and current name, as Mojang authenticated them. There is no separate sign-up, no email address and no password. An account owns [networks](https://minekube.com/guide/networks/concepts/network).

## Why a Minecraft account

Everyone who runs a Minecraft network already has a Minecraft account, and Mojang already checks it every time they join an online-mode server. Building on that identity means one account less to create and one password less to leak. It also makes the account the same identity players know you by in game.

## Logging in through the hub

The Minekube hub is a Minecraft server that Minekube runs in online mode, so Mojang checks every player who joins it. That check is the login.

1. You join the hub with Minecraft and ask for a code, with **[Log in]** in the chat.
2. The hub asks the Minekube API for a one-time code for your account. Only Minekube's login servers may ask for one.
3. You give the code to `mk login`, or to your coding agent.
4. `mk login` redeems the code, once, for a session.

The code appears in your own game, so nobody can push a login of theirs onto you. [Create a network](https://minekube.com/guide/networks/create-a-network#log-in) shows the steps.

## Sessions

A session is a pair of tokens: an access token for requests, which runs out soon, and a refresh token, which `mk` uses once to get the next pair. `mk` keeps the session in its home folder and refreshes it by itself.

- **A refresh token used twice ends its session,** because then someone else has it.
- **The Minekube API stores only hashes** of codes and tokens, so a copy of its storage signs nobody in.
- **Every request is checked against the store,** so a session that ended stops working at once. The API needs no signing key for sessions.
- **A session ends** after a long time without use, or a fixed time after the login at the latest. Then you join the hub again. [Limits](https://minekube.com/games/platform/limits#networks-in-the-minekube-plugin) lists both times.

## What an account can do

An account creates networks and owns them. As the owner, it lets servers in, keeps trust rules, lists the members and deploys code to them, for its own networks only.

The Minekube API's admins are not accounts. They are operators of an API, such as Minekube for its own or you for one you [host yourself](https://minekube.com/guide/networks/self-host), and they act with short-lived tokens from an issuer the API trusts.

## Built and planned

Accounts, the hub login, sessions and network ownership are built, in preview on staging. Not built yet: logging in on the web, and tokens for CI that act as an account.

## Related

- [Create a network](https://minekube.com/guide/networks/create-a-network): log in and create your first network.
- [The Minekube API](https://minekube.com/guide/networks/concepts/api): where accounts and sessions are stored.
