0

So I'm trying to get an auth token using got.js ("got": "^12.5.1"), but can't find much documentation. I'm sort of floundering here. Any examples out there? Here's what I have so far:

'use strict';

const applicationJson = 'application/json';
const got = require('got');

    module.exports = {
        getAuth: async function () {
            return await got.post(`https://yaddayaddayadda/fact`,{
                method: 'POST',
                json: {
                    username: 'foo',
                    password: 'bar',
                },
                responseType: 'json'
            }).json();
        }
    }
jonrsharpe
  • 115,751
  • 26
  • 228
  • 437
Huckleberry Carignan
  • 2,002
  • 4
  • 17
  • 33

0 Answers0