From ad58a8ec13f3c37f57f1a8794ece2075f449194c Mon Sep 17 00:00:00 2001 From: Ritchie Martori Date: Wed, 11 Dec 2013 16:42:47 -0800 Subject: [PATCH] Only look at cookies if they are available --- lib/models/access-token.js | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/lib/models/access-token.js b/lib/models/access-token.js index 14e57326..3ea22d35 100644 --- a/lib/models/access-token.js +++ b/lib/models/access-token.js @@ -174,13 +174,14 @@ function tokenIdForRequest(req, options) { } } - for(i = 0, length = headers.length; i < length; i++) { - id = req.signedCookies[cookies[i]]; + if(req.signedCookies) { + for(i = 0, length = headers.length; i < length; i++) { + id = req.signedCookies[cookies[i]]; - if(typeof id === 'string') { - return id; + if(typeof id === 'string') { + return id; + } } } - return null; }