Back to Today's Deal

API of my account info ?


#1

for example:

  • My coin value
  • Next Reward: Rare Chest
  • You need: 231 more spin
  • ETC

it would be very useful


#2

It currently exists https://api.chrono.gg/account
I believe you just need to pass along the auth header to get the data.

I’m seeing coin balance, legendary count, and number of coin spins. You should be able to infer the next chest from your current spin count perhaps by using the current spin count mod 30 and doing something with that value.


#3

Do you know if Chrono.gg minds if we access it? It seems to be undocumented – first I’ve heard of it.


#4

Not sure, but when you hit the main site, it ajax requests it in the background. I don’t have any more access to it than you do AFAIK. I can ask though.


#5

what would be the structure of the auth header ?


#6

I have been told that I am unauthorized to access this info.

In fact, all I see is a blank screen that says:

“Unauthorized”


#7

I was told that it isn’t intended to be automated against but it’s public so it’s fine. I’d add on to that to say just don’t abuse it by calling it too much and there shouldn’t be an issue.

Check the network traffic in the developer console for the request information when you load the main page. You may need to ctrl F5. I don’t have any insider info really regarding this so what you see is what I see unless they add some beta feature to my account.

@YQMaoski
From the browser you won’t be able to easily do that is why. When you hit the page with a request, you aren’t passing any auth header so you are denied access. You’d have to structure a GET request with the appropriate authorization header and send that.


#8

the api could request the token and then automatically enter the account information.

example:


#9

JavaScript:

const getConnectionAccount = () => {

    const account = URL = "https://api.chrono.gg/account"

    let h = new Headers()

    h.append('Accept','application/json)')
    h.append('Authorization','{JSON Web Token}')

    let req = new Request(URL,{
      method: 'GET',
      headers: h,
      mode: 'cors'
    });
    fetch(req)
      .then( (response) => {
          if(response.ok){
            console.log(response.json());
          }
      });

    };

    getConnectionAccount();

you have to occupy the value that is in that field and replace it in the line where it says {JSON Web Token} and execute the script


#10

Sounds like you figured it out! :+1:


#11

Yes, ready for my dashboard page


#12

Pretty neat