Skip to content

Commit d2884aa

Browse files
committed
Supports null values
I was having problems because my `this.req.body` is `null`, not `undefined` so i keep getting the `Only one method may be used to authenticate at a time` error.
1 parent a2485db commit d2884aa

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

lib/authorise.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,8 +59,7 @@ function getBearerToken (done) {
5959
postToken = this.req.body && this.req.body.access_token;
6060

6161
// Check exactly one method was used
62-
var methodsUsed = (headerToken !== undefined) + (getToken !== undefined) +
63-
(postToken !== undefined);
62+
var methodsUsed = (!!headerToken) + (!!getToken) + (!!postToken);
6463

6564
if (methodsUsed > 1) {
6665
return done(error('invalid_request',

0 commit comments

Comments
 (0)