Skip to content

Commit 3c39a7e

Browse files
added readme
1 parent 88f9c19 commit 3c39a7e

File tree

2 files changed

+124
-7
lines changed

2 files changed

+124
-7
lines changed

.github/workflows/main.yaml

+2-5
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,8 @@ name: Build Rust Project
22

33
on:
44
push:
5-
branches:
6-
- master
7-
pull_request:
8-
branches:
9-
- master
5+
tags:
6+
- "v*.*.*"
107

118
jobs:
129
build:

README.md

+122-2
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,122 @@
1-
> [!Warning]
2-
> Сервис все еще в разработке. На данный момент не может быть использован по назначению
1+
# Minecraft OAuth Provider
2+
3+
## 🚀 Description
4+
MC-oAuth-rs is an all-in-one solution that allows users to log in to a website using their Minecraft account without entering their username or password.
5+
6+
It’s secure, simple, and user-friendly, enabling logins only for users with a licensed Minecraft account.
7+
The service supports Minecraft versions above 1.8.
8+
9+
## 💡 How it works?
10+
Our service provides an authentication system that requires no complex actions from users or developers.
11+
All you need to do is join a Minecraft server and get a 6-digit code, then enter it on the website that uses this service.
12+
13+
### 🔑 Features
14+
- 📋 Get username, UUID, and skin through REST API
15+
- 🛡️ Zero Trust (it is impossible to fake Minecraft account data)
16+
- ⚡ Easy to use and implement
17+
- 🔒 The server only processes the authentication process and nothing more
18+
19+
## 💻 For Users
20+
Websites that use this service will ask you for a 6-digit code, which you can get by joining the Minecraft server `auth.mc-oauth.andcool.ru` (or others), then entering it on the website.
21+
**The website developer will get access to your username, UUID, and skin.**
22+
23+
## 🛠️ For Developers
24+
To integrate this service, add a form on your website for entering the 6-digit code. After the user enters the code, make a request to the API endpoint described below.
25+
26+
### 📡 API Endpoint
27+
```
28+
GET /code/<6-digit code>
29+
```
30+
31+
### Example of a successful response from the server:
32+
```json
33+
{
34+
"nickname": "AndcoolSystems",
35+
"UUID": "1420c63cb1114453993fb3479ba1d4c6",
36+
"properties": [
37+
{
38+
"name": "textures",
39+
"signature": "<base64 string; signed data using Yggdrasil's private key>",
40+
"value": "<base64 string>"
41+
}
42+
]
43+
}
44+
```
45+
*You can read more about the data inside `properties` [here](https://minecraft.wiki/w/Minecraft_Wiki:Projects/wiki.vg_merge/Protocol_Encryption#Server).*
46+
47+
> [!NOTE]
48+
> The code is valid for 5 minutes after issuance and can only be used once.
49+
50+
## 🛠️ Local Deployment
51+
To run this service locally, first install [Rust](https://www.rust-lang.org/tools/install).
52+
53+
Then run these commands:
54+
```shell
55+
git clone https://github.com/Andcool-Systems/mc-oauth-rs.git
56+
cd mc-oauth-rs
57+
58+
cargo build --release
59+
```
60+
61+
After the project is fully built, the binary file for your OS will be available at `./target/release/mc-oauth.*`.
62+
63+
### 📋 Configuration
64+
For the server to work, create a `config.toml` file in the same directory as the executable with the following contents:
65+
66+
```toml
67+
[api]
68+
# API address
69+
addr = "0.0.0.0"
70+
# API port
71+
port = 8008
72+
# Life time of assigned code
73+
code_life_time = 300
74+
75+
[server]
76+
# Minecraft server address
77+
addr = "0.0.0.0"
78+
# Minecraft server port
79+
port = 25565
80+
# Server connection timeout
81+
timeout = 10
82+
83+
[server.config]
84+
# Protocol version (`0` for auto)
85+
protocol = 0
86+
# Minecraft version string
87+
version = "1.21"
88+
# Session Auth URL
89+
# `{{NAME}}` in string will be replaced by the client nickname
90+
# `{{HASH}}` will be replaced by the generated client hash
91+
auth_url = "https://sessionserver.mojang.com/session/minecraft/hasJoined?username={{NAME}}&serverId={{HASH}}"
92+
93+
[server.status]
94+
# Server description (you can use MOTD)
95+
description = "§6mc-oauth.andcool.ru"
96+
# Max players count, displayed in server list
97+
players_max = 0
98+
# Online players count, displayed in server list
99+
players_online = 0
100+
# Path to the server icon (can be empty)
101+
icon_path = "server_icon.png"
102+
103+
[messages]
104+
# Message for successful auth
105+
# `{{NAME}}` will be replaced by the client nickname
106+
# `{{UUID}}` will be replaced by the client UUID
107+
# `{{CODE}}` will be replaced by the generated code
108+
success = "Hello, §6{{NAME}}§r! Your code is: §a{{CODE}}"
109+
# Message for Mojang API error
110+
bad_session = "§cFailed to login: Invalid session (Try restarting your game and the launcher)"
111+
```
112+
113+
> [!NOTE]
114+
> The server icon should be in `.png` format and 64x64 pixels in size.
115+
> `timeout` in the config sets the **maximum** time that the client can be connected before the server disconnects.
116+
> `protocol` is used only during the server ping and is ignored when trying to connect. If set to `0`, the protocol version that the client uses will be applied.
117+
118+
### 🚀 Running
119+
After configuring, run the compiled binary file through the console.
120+
121+
---
122+
**Created by AndcoolSystems with ❤, 3 February, 2025**

0 commit comments

Comments
 (0)