title: How to authenticate using bearer token using got.js
body: <p>I'm trying to switch from <code>request.js</code> to <code>got.js</code>. I expect to see the <code>got.js</code> implementation authenticate similarly to how the <code>request.js</code> library does. But, instead, I get the following error.</p>
  
  <blockquote>
    <p>auth no longer supported. Replaced by username and password.</p>
  </blockquote>
  
  <p>There is no mention of <code>bearer</code> tokens on the docs page.</p>
  
  <p>So how do I authenticate my request using bearer tokens using <code>got.js</code>? Or what am I doing wrong?</p>
  
  Current code: request.js, working
  
  <pre class="lang-js prettyprint-override"><code>const request = require('request');
  const module.exports = config =&gt; {
    const options = {
      auth: {
        bearer: config.secret,
      },
    };
    const result = await new Promise(( resolve, reject, ) =&gt; {
      request.get( url, options, ( error, response, body, ) =&gt; {
    ...
  </code></pre>
  
  New code: got.js, throws error
  
  <pre class="lang-js prettyprint-override"><code>const got = require('got');
  
  module.exports = async config =&gt; {
    const options = {
      auth: {
        bearer: config.secret,
      },
    };
    const result = await got(url, options);
    ...
  }
  </code></pre>