- heroku hosted web server and api example to ease authentication flow with newly migrated microsoft accounts
- info about the web app
- (down - free azure membership ended)
simple server/web app and node wrapper for the Minecraft Realms API
- all
mc-realms
api requests besides/
require atoken
query param - optional query params:
version
: minecraft version (current default: 1.17.1)
/
- GET request => registering & granting auth to azure app
- redirects to
/token?code=<CODE>
<CODE>
will be your one time use generated code by the microsoft oauth flow process
/profile?token=<TOKEN>
- GET request => user account profile
/worlds?token=<TOKEN>
- GET request => user account realms
/userdata?token=<TOKEN>
- GET request => user account profile & realm information
<TOKEN>
is your minecraft access token you either parsed or received earlier throughout the oauth flow process- written in a day, so expect changes.
- mojang has been in the process of migrating user accounts to microsoft accounts
- previous versions of this api return an error/warning detailing the account migration
- migrating an account to microsoft will introduce the end user to the
microsoft oauth flow
- oauth code
- oauth code => oauth token
- oauth token => xbl auth
- xbl auth => xsts auth
- xsts auth => minecraft auth
- minecraft auth => check ownership of game
- user authenticated and can now get profile/realm/server info
- the microsoft oauth flow is documented on the wiki
- due to the microsoft oauth flow differing from the mojang oauth flow, the authentication process pipeline is broken once migrating accounts
- I hosted a web server/app api connected to a free azure application that makes it easy for anyone to authenticate with the new microsoft oauth flow
- once the auth process is completed, you will receieve your
access_token
, which can be used within themc-realms
api ecosystem or the minecraft realms api ecosystem- sign in with microsoft
- give permission to
mc-realms
azure application - if the login/authentication process is successful you will receive a payload with an
access_token
, which can now be used within the minecraft ecosystem to retreive account information
- the access token has a lifetime of 86400 seconds (24 hours/1 earth day)
- after that, you can refresh or issue yourself a new token
- occasionally,
pc.realms.minecraft.net
will return aRetry again later
response, this is typical and it just means to try again later
- end user can now use mc-realms endpoints with their token
- API ENDPOINTS
-due account migration to microsoft based authentication, any authentication with migrated accounts requires use of an azure application client id & secret
-hosting your own mc-realms server/web app requires some knowledge of microsoft azure. prior to anything below you should have an application set up and ready to be configured. you can follow instructions on how to create an azure application here
git clone https://github.com/revzim/mc-realms
yarn
ornpm i
- copy
.env.default
to.env
PORT
=> the port you will host your server/webapp fromCLIENT_ID
=> your azure application client idCLIENT_SECRET
=> your azure application client secretREDIRECT_URI
=> a valid redirect uri for your azure application- default is
http://localhost/token
to emulate how the mc-realms web app works - within the context of this server, unless you are altering any of the source code, redirect uris should follow the paradigm
host/token
to work ootb
- default is
- run dev:
yarn dev
||npm run dev
- build:
yarn build
||npm run build
=>yarn start
||npm run start
- head to http://localhost
- API ENDPOINTS
- source code prior to microsoft account migration moved to /mojang