Minecraft oAuth

A free to use, public Minecraft oAuth solution for everyone.


What is this ?


MC-oAuth is an all in one solution to allow people to login with their Minecraft account to a website without having to enter their username or password. It's easy to use and secure, it will only allow people with a valid Minecraft account to login. We always support the latest Minecraft versions the day they are released to ensure your site have no problems. This service is free to use and only requires a small amount of PHP code on your end to verify a user token. All the end user has to do is join one of our Minecraft servers and enter the code given to them on websites using our service. All data sent between websites and our API is sent over TLS 1.2.


For users


Websites that use our service will ask you for a 6 digit code, to get that code simply join one of our Minecraft servers listed below, you will get kicked with a 6 digit code, simply enter that code on the website to login.

Servers


We offer servers for different versions of Minecraft, they're listed below:

srv.mc-oauth.net:25565 - Auth server for Minecraft 1.8.X/1.9.X/1.10.X/1.11.X/1.12.X/1.13.X


For developers


Getting started with MC-oAuth is really simple, all you need to do is send one request to our API with a user token to get the users uuid and username.
Below is an example of how to resolve a token with Node.js, using the node-fetch library.


const fetch = require("node-fetch");

function oAuthToUUID(token) {
   return fetch('https://mc-oauth.net/api/api?token', {
      method: "GET",
      headers: {
         "token": token
      }
   }).then(response => {
      return response.json();
   }).then(json => {
      return json.status === 'success' ? json.uuid : 'fail';
   });
}

oAuthToUUID(uuid => {
   if (uuid !== 'fail') {
      // Handle successful login
   } else {
      // Handle invalid token
   }
});

And here is an example how to resolve it using PHP:


// PHP Example

// The user token provided by the user via POST
// Make sure the token is 6 digits!
$token = "user-token";

// Create a stream, to add our token header
$opts = [
   "http" => [
      "method" => "GET",
      "header" => "Accept-language: en\r\n" .
      "token: $token\r\n"
   ]
];

$context = stream_context_create($opts);

// Make our request to the API
$data = file_get_contents('https://mc-oauth.net/api/api?token', false, $context);

// Decode the json data
$json = json_decode($data);

// Check if the token is valid
if ($json->status == 'success') {
   $username = $json->username;
   $uuid = $json->uuid;
   // Handle successful login
} else {
   // Handle invalid token
}
Here is a simple cURL request to check a user token: curl -H "token: <user-token>" https://mc-oauth.net/api/api?token.
All API calls are done over SSL.

Tell people to join mc-oauth.net:25565 and enter the code given to them on your website. Please keep in mind that a token is only valid for 5 minutes.

API Responses, payloads, and requests


The MC-oAuth API endpoint is https://mc-oauth.net/api/api, all responses are in the JSON format.

Format: Endpoint, header value, response

https://mc-oauth.net/api/api?token
token=<user-token>
{"status":"success|fail","message":"<error messages>","username":"<username>","uuid":"<uuid>"}


Test our service


Join one of our servers and enter your token below:

Token


About MC-oAuth


MC-oAuth has been made by Deftware