The Auth0 /userinfo endpoint returns an unauthorized error
<p>It's giving unauthorized as result error even when I pass the bearer token in Node.js application.</p>

<pre><code>    function getUser(authData){
      var postData = querystring.stringify({ authorization: authData });

      var options = {
        host: 'pole.auth0.com',
        method: 'GET',
        path: '/userinfo'
      };

      //make request
      httpsRequest(postData, options)
        .then(function(result) {
          // success
          res.status(201).send({ 'success': true });
        }, function(err) {
          res.status(500).send({ 'success': false, 'reasonCode': "Internal error." });
        });
    };
</code></pre>

<p>Helper function:</p>

<pre><code>function httpsRequest (data, options) {
    return new Promise(function (resolve, reject) {
        var req = https.request(options, function (res) {
            var result = '';
            console.log(options);
            res.on('data', function (chunk) {
                result += chunk;
            });
            res.on('end', function () {
                console.log("https end result - " + result);
                resolve(result);
            });
            res.on('error', function (err) {
                reject(err);
            })
        });

        // req error
        req.on('error', function (err) {
            reject(err);
        });

        //send request witht the postData form
        req.write(data);
        req.end();
    });
}
</code></pre>

<p>The <code>authData</code> parameter has a string value like <code>Bearer [token]</code>. I'm using https.request to make the api request</p>

<p>Is there anything wrong on the code?</p>