Skip to content

Instantly share code, notes, and snippets.

@overestimate
Created December 21, 2021 19:32
Show Gist options
  • Save overestimate/c7864f29767d92702852bf9ac997ec78 to your computer and use it in GitHub Desktop.
Save overestimate/c7864f29767d92702852bf9ac997ec78 to your computer and use it in GitHub Desktop.
minecraft userscript/console js to copy token to clipboard
console.log("bearer below.")
console.log(document.cookie.split(';').find(b=>b.includes('bearer_token=')).split('=')[1])
// ==UserScript==
// @name Minecraft Bearer Grab
// @namespace https://overestimate.ninja/
// @version 0.1
// @description Grab your access token when loading the profile page.
// @author github/overestimate
// @match https://minecraft.net/en-us/profile/
// @require http://code.jquery.com/jquery-3.4.1.min.js
// @grant none
// ==/UserScript==
(function() {
'use strict';
if (document.cookie.split(';').find(b=>b.includes('bearer_token=')).split('=')[1] != null && document.cookie.split(';').find(b=>b.includes('bearer_token=')).split('=')[1] != undefined && document.cookie.split(';').find(b=>b.includes('bearer_token=')).split('=')[1] != "")
{
(a=>{if(navigator&&navigator.clipboard)return navigator.clipboard.writeText(a)})(prompt('Here is your bearer token.',document.cookie.split(';').find(b=>b.includes('bearer_token=')).split('=')[1]));
}
})();

Userscript

Click the raw button here, and import into your userscript manager (preferably TamperMonkey)

Console Command

CTRL-SHIFT-J, paste code, press enter, token printed in console.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment