Search code examples
postmanrumble-api

How to get access token for Rumble API?


I have a key and a secret.

According to https://dev.rumbletalk.com/rest/authentication

I can issue a request to get an access token:

https://api.rumbletalk.com/token

passing key and secret as parameters:

enter image description here

However, I am getting

{
"type": "Exception",
"status": false,
"message": "Missing credentials: key, secret"
}

Any idea why?

Rumble API key and secret have correct values from the collection variables.


Solution

  • URL

    POST https://api.rumbletalk.com/token
    

    Using raw instead of form-data or application/x-www-form-urlencoded

    In body,

    {
       "key":"your key",
       "secret":"your secret"
    }
    

    enter image description here

    cURL call

    curl --location --request POST 'https://api.rumbletalk.com/token' \
    --header 'Content-Type: application/json' \
    --data-raw '{
       "key":"your key",
       "secret":"your secret"
    }'
    

    cURL Result

    enter image description here

    node.js call

    Save as demo.js

    const axios = require("axios");
    
    const getToken = async () => {
        try {
            const res = await axios.post(
                'https://api.rumbletalk.com/token',
                {
                  'key': 'your key',
                  'secret': 'your secret'
                },
                {
                  headers: {
                    'Content-Type': 'application/json'
                  }
                }
            );
            return Promise.resolve(res.data);
        } catch (error) {
            return Promise.reject(error);
        }
    };
    
    getToken()
        .then(result => {
            console.log(result);
        })
        .catch(error => {
            console.error(error);
        });
    

    node.js Result

    enter image description here