title: Implementing passport-http-bearer token with sails.js
body: <p>I am trying to implement passport's <code>passport-http-bearer</code> strategy, but it found no user with info <code>Bearer realm=&quot;Users&quot;</code>.</p>
  <p>My <code>request</code> is a post request:</p>
  <pre><code>{'token':'simple_access_token',} 
  </code></pre>
  <p>Any one has any idea why this error occurs? Also I know here <code>req</code> should be <code>https</code> or <code>ssl</code> instead of <code>http</code>. How do I do that?</p>
  <p>The code I am using is:</p>
  <pre><code>bearerPassportToken: function(req,res){
          passport.authenticate('bearer', function(err, user, info){
            if ((err) || (!user)) {
              if (err) return;
              if (!user)  
                  console.log(&quot;info&quot;);//Info: Bearer realm=&quot;Users&quot;
              res.redirect('/login');
              return;
            }
            req.logIn(user, function(err){
              if (err){
                  res.redirect('/login');
              }
              //Need to write code for redirection
              ;
            });
          })(req, res);
      },
  </code></pre>