Jump to content

Featured Comment

Posted

Hello!

I’m trying to get my balances using Stake API.

(node.js axios)

Quote

async function getrate() {

  const response = await axios.post(
    'https://stake.com/_api/graphql',
    {},
    {
      headers: {
        "User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:108.0) Gecko/20100101 Firefox/108.0",
                  'cookie': '__cf_bm=<removed>; cf_clearance=<removed>;',
        'Origin': 'https://stake.com/',
        'x-lockdown-token': 'undefined',
        'x-access-token': 'removed',
        'content-type': 'application/json'
      },
      query: ` 
      query CurrencyConversionRate {\n  info {\n    currencies {\n      name\n      jpy: value(fiatCurrency: jpy)\n      }\n  }\n}\n
      `,
    },
  );
}

but 403 error occurs.

Maybe there’s a problem with cf_bm and clearance.

Please tell me how to get them !!

 

Posted

Hi, you can get the cf_clearance cookie by looking trough you'r request using normal web browser (chrome/firefox).
go to stake.com and open developer console then look for Fetch/XHR graphql < open any of that request and go to "cookies" section, there will be cookie that you need to use later on in your nodejs request.

 

tttaatatatatatatatat.png

Posted

Unfortuneately i dont know what is a lifetime for cf_clearance cookie in stake, but so far i've used only 1cf_clearance cookie for long time and it is still valid, i had no issue so far, so it may be valid as long as it's used. (i can't confirm 100%).

.

Posted

Thank you very much!

I may ask you a question if there is another problem.

thx!

 

dvdx1995 can you send some examples of curl or axios request?

403 err is still occurring

  • 2 weeks later...
  • 9 months later...
  • 11 months later...
Posted

Apologies for bringing this topic up again. I've tried a few times with Node.js, but I keep encountering a 403 error. My code is as follows. Could you please help me identify where exactly I'm going wrong?

<code>

 

const axios = require('axios')

 

const url = 'https://stakeru9.com/_api/graphql';

const headers = {

    'Content-Type': 'application/json',

    'X-Access-Token': '<Api Key>',

    'X-Lockdown-Token': 's5MNWtjTM5TvCMkAzxov',

    '_cf_bm':'KsLXCI4NJ8HJ8fne6K26ZHAVdput2RNikuTrmQPLEzw-1728416228-1.0.1.1-uelz77SGOumwq81o3GLp7zetf0ecF0je8d8eC55UGdC0qzT8QL4iuYbWnNTziGmNhr29aFai6q5zxXVaZi3tyQ',

    'Origin': 'https://stakeru9.com',

    'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/129.0.0.0 Safari/537.36',

    'Cookie':'currency_hideZeroBalances=false; currency_currencyView=crypto; fiat_number_format=en; casinoSearch=["Monopoly","Crazy Time","Sweet Bonanza","Money Train","Reactoonz"]; sportsSearch=["Liverpool FC","Kansas City Chiefs","Los Angeles Lakers","FC Barcelona","FC Bayern Munich"]; oddsFormat=decimal; sportMarketGroupMap={}; locale=tr; _ga=GA1.1.1659329437.1727979566; intercom-id-cx1ywgf2=b6692a36-47ec-4df0-9dca-631a5e7d9c14; intercom-device-id-cx1ywgf2=dcd4b6b0-93d8-4cd9-8e6e-fab795a07eca; session=<Api Key>; session_info={"id":"62ed27b0-042f-4cc8-83aa-6cb1d047c56f","sessionName":"Chrome (Unknown)","ip":"176.216.178.34","country":"TR","city":"Antalya","active":true,"updatedAt":"Thu, 03 Oct 2024 18:20:27 GMT","__typename":"UserSession"}; currency_currency=usdt; sidebarView=betslip; cookie_consent=true; fullscreen_preference=false; leftSidebarView_v2=expanded; intercom-session-cx1ywgf2=eVIzNGNNSFlaejBsbHE3a0w4dzBXa291a1JkWWlxN2FUTUF1OUcrYkZiZHVYZHVxZDdneUF1QmdROFUyY3lFVC0td2h2dGdlRHBzR2pmK3ZnMUJUNk1kQT09--72bb3aeef7bd92207f28ae1304744c5c9c6ab68f; __cf_bm=KsLXCI4NJ8HJ8fne6K26ZHAVdput2RNikuTrmQPLEzw-1728416228-1.0.1.1-uelz77SGOumwq81o3GLp7zetf0ecF0je8d8eC55UGdC0qzT8QL4iuYbWnNTziGmNhr29aFai6q5zxXVaZi3tyQ; _ga_TWGX3QNXGG=GS1.1.1728415329.6.1.1728416291.0.0.0; _dd_s=rum=0&expire=1728417201758',

    'Referer':'https://stakeru9.com/tr/casino/games/limbo'

};

 

const body = JSON.stringify({

    query: `

        mutation LimboBet($amount: Float!, $multiplierTarget: Float!, $currency: CurrencyEnum!, $identifier: String!) {

            limboBet(

                amount: $amount

                currency: $currency

                multiplierTarget: $multiplierTarget

                identifier: $identifier

            ) {

                ...CasinoBet

                state {

                    ...CasinoGameLimbo

                }

            }

        }

 

        fragment CasinoBet on CasinoBet {

            id

            active

            payoutMultiplier

            amountMultiplier

            amount

            payout

            updatedAt

            currency

            game

            user {

                id

                name

            }

        }

 

        fragment CasinoGameLimbo on CasinoGameLimbo {

            result

            multiplierTarget

        }

    `,

    variables: {

        multiplierTarget: 2,

        identifier: "l7nCTS9fJQnSCsTvQHFIV",

        amount: 0.01001,

        currency: "usdt"

    }

});

 

axios.post(url, body, { headers: headers })

.then(response => {

    if (!response.ok) {

        throw new Error(`HTTP error! Status: ${response.status}`);

    }

    return response.json();

})

.then(data => console.log(data))

.catch(error => console.error('Error:', error));

</code>

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...