Skip to content

Instantly share code, notes, and snippets.

@Jackzmc
Last active November 15, 2020 20:07
Show Gist options
  • Save Jackzmc/1c464e3e45c877859bba268ca9a33546 to your computer and use it in GitHub Desktop.
Save Jackzmc/1c464e3e45c877859bba268ca9a33546 to your computer and use it in GitHub Desktop.
/*
1. Must be logged on "socialclub.rockstargames.com" domain
2. Paste in dev tools console (CTRL+SHIFT+I)
3. Paste the below code & enter username in prompt
*/
var ID2find = prompt("What is the social club username?");
var req = new XMLHttpRequest();
req.onreadystatechange=function(){
if(req.readyState ===4){
var res = JSON.parse(req.response);
if(!res || !res.accounts) return console.error('API Did not return any account data');
if(res.accounts.length == 0)return console.error("No accounts found");
if(res.message) return console.error('Something happened: ' + res.message);
console.log(res.accounts[0].rockstarAccount.name + "'s SCID: " + res.accounts[0].rockstarAccount.rockstarId)
}
};
req.open("GET","https://scapi.rockstargames.com/profile/getprofile?nickname=" + ID2find.toLowerCase());
req.setRequestHeader("Authorization","Bearer " + getCookie("BearerToken"));
req.setRequestHeader("x-requested-with","XMLHttpRequest")
req.send();
function getCookie(e){for(var n=e+"=",t=decodeURIComponent(document.cookie).split(";"),o=0;o<t.length;o++){for(var r=t[o];" "==r.charAt(0);)r=r.substring(1);if(0==r.indexOf(n))return r.substring(n.length,r.length)}return""}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment