title: How Can I test a basic Bearer Strategy for Passport.js using Postman
body: <p>I'm trying to grasp passport at the moment, particularly how to Authenticate a Restful api and I am a little unsure how to test it what I have</p>
  
  <p>I have the following BearerStrategy:</p>
  
  <pre><code>var BearerStrategy = new Bearer({
    },
    function(token, done) {
      process.nextTick(function () {
  
        findByToken(token, function(err, user) {
          if (err) { return done(err); }
          if (!user) { return done(null, false); }
          return done(null, user);
        })
      });
    }
  );
  </code></pre>
  
  <p>where findByToken is:</p>
  
  <pre><code>var api_users = [
      { id: 1, username: 'bob', token: '123456789', email: 'bob@example.com' }
    , { id: 2, username: 'joe', token: 'abcdefghi', email: 'joe@example.com' }
  ];
  function findByToken(token, fn) {
    for (var i = 0, len = users.length; i &lt; len; i++) {
      var user = api_users[i];
      if (user.token === token) {
        return fn(null, user);
      }
    }
    return fn(null, null);
  }
  </code></pre>
  
  <p>and I then Have the following route:</p>
  
  <pre><code>app.get('/api', passport.authenticate('bearer', { session: false}), function (request, response){
      response.send('BAM! you got a response');
  });
  </code></pre>
  
  <p>I have tried testing in postman but and I get <code>Unauthorized</code> but I am unsure how to test this for success. The above code is not all mine, it is the simplest solution I could piece together from a few snippets I found online.</p>
  
  <p>In Post man I have the options: Normal, Basic Auth which requires the params <code>username and Password</code></p>
  
  <p>Digest Auth which look's for params <code>Username, Realm, Password, Nonce, Algorithm, qop, Nonce count, Client nonce, Opaque</code></p>
  
  <p>OAuth 1.0 which looks for the params <code>Consumer Key, Consumer Secret, Token, Token Secret, Signature Method, Timestamp,Nonce, Version, Realm, Add params to header ,Auto add parameters
  </code></p>
  
  <p>This is all new to me and I have tried Googling how to test. Any Guidance anyone can offer would be great.</p>