{"id":18448511,"url":"https://github.com/ccbluex/mc-authlib","last_synced_at":"2025-11-29T09:04:55.967Z","repository":{"id":211573942,"uuid":"729493595","full_name":"CCBlueX/mc-authlib","owner":"CCBlueX","description":"Kotlin library providing Minecraft authentication functionality","archived":false,"fork":false,"pushed_at":"2025-11-21T17:01:12.000Z","size":130,"stargazers_count":8,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-11-21T17:25:56.209Z","etag":null,"topics":["authentication","kotlin","minecraft","mojang-api"],"latest_commit_sha":null,"homepage":"","language":"Kotlin","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mpl-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/CCBlueX.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-12-09T12:08:14.000Z","updated_at":"2025-11-21T17:00:43.000Z","dependencies_parsed_at":"2023-12-09T13:26:57.009Z","dependency_job_id":"07680184-f162-4441-9eb5-bea1b23c953b","html_url":"https://github.com/CCBlueX/mc-authlib","commit_stats":null,"previous_names":["ccbluex/mc-authlib"],"tags_count":9,"template":false,"template_full_name":null,"purl":"pkg:github/CCBlueX/mc-authlib","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CCBlueX%2Fmc-authlib","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CCBlueX%2Fmc-authlib/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CCBlueX%2Fmc-authlib/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CCBlueX%2Fmc-authlib/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/CCBlueX","download_url":"https://codeload.github.com/CCBlueX/mc-authlib/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CCBlueX%2Fmc-authlib/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":27343693,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-11-29T02:00:06.589Z","response_time":56,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["authentication","kotlin","minecraft","mojang-api"],"created_at":"2024-11-06T07:16:07.283Z","updated_at":"2025-11-29T09:04:55.955Z","avatar_url":"https://github.com/CCBlueX.png","language":"Kotlin","funding_links":[],"categories":[],"sub_categories":[],"readme":"# MC AuthLib\nMC AuthLib is a library designed to make the integration of different account types in Minecraft easier. \\\nBased on [Elixir](https://github.com/UnlegitMC/Elixir) - a discontinued project by UnlegitMC.\n\n## Used by\n- [LiquidBounce](https://liquidbounce.net/) - A free Minecraft Hacked Client for Fabric 1.21.5\n\n# Features\n- Login to Minecraft using different account types\n- Favorite Account\n- Ban Tracker\n- Replicated Yggdrasil API for usage in newer versions of Minecraft\n- Pulls UUIDs from Mojang API for Cracked Accounts\n\n## Supported account types\n- Microsoft (Premium via Xbox Sign In)\n- The Altening (Alt-service)\n- Cracked (Username)\n- Session (Access Token)\n\n# Installation\n\nAdd the repository once and depend on the artifact shown below.\n\n#### Gradle (Kotlin DSL)\n\n```kotlin\nrepositories {\n    maven(\"https://maven.ccbluex.net/releases\")\n}\n\ndependencies {\n    implementation(\"net.ccbluex:mc-authlib:1.5.0\")\n}\n```\n\n#### Gradle (Groovy DSL)\n\n```groovy\nrepositories {\n    maven {\n        url \"https://maven.ccbluex.net/releases\"\n    }\n}\n\ndependencies {\n    implementation 'net.ccbluex:mc-authlib:1.5.0'\n}\n```\n\n#### Maven\n\n```xml\n\u003crepositories\u003e\n    \u003crepository\u003e\n        \u003cid\u003eccbluex-maven\u003c/id\u003e\n        \u003curl\u003ehttps://maven.ccbluex.net/releases\u003c/url\u003e\n    \u003c/repository\u003e\n\u003c/repositories\u003e\n\n\u003cdependencies\u003e\n    \u003cdependency\u003e\n        \u003cgroupId\u003enet.ccbluex\u003c/groupId\u003e\n        \u003cartifactId\u003emc-authlib\u003c/artifactId\u003e\n        \u003cversion\u003e1.5.0\u003c/version\u003e\n    \u003c/dependency\u003e\n\u003c/dependencies\u003e\n```\n\n# Usage\n\n[LiquidBounce's `AccountManager`](https://github.com/CCBlueX/LiquidBounce/blob/nextgen/src/main/kotlin/net/ccbluex/liquidbounce/features/account/AccountManager.kt) uses MC AuthLib in practice.\n\n## 1. Account creation\n\n```kotlin\nobject AccountRegistry {\n    private val accounts = mutableListOf\u003cMinecraftAccount\u003e()\n\n    fun addMicrosoftAccount(openBrowser: (String) -\u003e Unit, onComplete: (Result\u003cMinecraftAccount\u003e) -\u003e Unit) {\n        MicrosoftAccount.buildFromOpenBrowser(object : MicrosoftAccount.OAuthHandler {\n            override fun openUrl(url: String) = openBrowser(url)\n\n            override fun authResult(account: MicrosoftAccount) {\n                accounts += account\n                onComplete(Result.success(account))\n            }\n\n            override fun authError(error: String) {\n                onComplete(Result.failure(IllegalStateException(error)))\n            }\n        })\n    }\n\n    fun addCrackedAccount(username: String, onlineLookup: Boolean = false): MinecraftAccount =\n        CrackedAccount(username, onlineLookup).also { cracked -\u003e\n            cracked.refresh()\n            accounts += cracked\n        }\n\n    fun addSessionAccount(token: String): MinecraftAccount =\n        SessionAccount(token).also { session -\u003e\n            session.refresh()\n            accounts += session\n        }\n}\n```\n\n## 2. Log in with Minecraft\n\n```kotlin\nfun login(account: MinecraftAccount): SessionBundle {\n    val (compatSession, service) = account.login()\n\n    // Adapt compat session to the actual Minecraft client session.\n    val clientSession = net.minecraft.client.session.Session(\n        compatSession.username,\n        compatSession.uuid.toString(),\n        compatSession.token,\n        compatSession.type\n    )\n\n    MinecraftClient.getInstance().session = clientSession\n}\n```\n\n## 3. Store and load accounts\n\n```kotlin\nfun saveAccounts(path: Path, accounts: List\u003cMinecraftAccount\u003e) {\n    val jsonArray = JsonArray()\n    accounts.forEach { jsonArray.add(it.toJson()) }\n    Files.writeString(path, jsonArray.toString())\n}\n\nfun loadAccounts(path: Path): MutableList\u003cMinecraftAccount\u003e {\n    if (!Files.exists(path)) return mutableListOf()\n\n    val jsonArray = JsonParser.parseString(Files.readString(path)).asJsonArray\n    return jsonArray.map { MinecraftAccount.fromJson(it.asJsonObject) }.toMutableList()\n}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fccbluex%2Fmc-authlib","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fccbluex%2Fmc-authlib","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fccbluex%2Fmc-authlib/lists"}