OPSkins / trade-opskins-api

API docs for trade.opskins.com
41 stars 19 forks source link

Can't pass my API key in post request #102

Closed enisgur closed 5 years ago

enisgur commented 5 years ago

note: I changed the real values at bellow question

 request
    .post('https://api-website.com/Offer/v1/')
    .send({ key1: 'asdasd', data2: '4654654' })
    //.set('authorization', 'Basic 6465456465465bawe465') //tried that did't work
    //.set('authorization', '6465456465465bawe465') //tried that did't work
    //.set('user', '6465456465465bawe465') //tried that did't work
    //.set('X-API-Key', 'Basic 6465456465465bawe465') //tried that did't work
    //.set('X-API-Key', '6465456465465bawe465') //tried that did't work
    //.set('6465456465465bawe465') //tried that did't work
    //.set('6465456465465bawe465', null) //tried that did't work
    //.auth('Basic 6465456465465bawe465') // tried :(
    //.auth('6465456465465bawe465') // tried :(
    .set('Accept', 'application/json')
    .end((err, res) => {
        // Calling the end function will send the request
        console.log(res.body);
    });

Getting output like this:

{ status: 401, time: 1540447809, message: 'API Key Required' }

I don't know what to do. I am trying other middle-wares(http post, https.post, request, superagent, axios, ..etc ) also but still getting same output. please help.

may I have a sample post request for : https://api-trade.opskins.com/ITrade/SendOffer/v1/

I have all the informations from opskin-api. Client_id, Secret Bearer token, Api Key, also I have 2 account with item to try to send offer each other to test. I know their uid, token, trade_url, twofactor_code .. etc.. but got stack here

rannmann commented 5 years ago

Authorization not authorization. And remember it should be sent as a base64-encoded string suffixed with a colon.

Key:

Buffer.from("your_api_key_value" + ":", "ascii").toString("base64")

Header:

Authorization: Basic ZmYzNzFiMDQ1MzA3OiRuR3dZVmRhQEBQRXJLQVVwRyNrSFEmWUExTClBKlgx

enisgur commented 5 years ago

Thank you very much ! It works !