File tree Expand file tree Collapse file tree 2 files changed +13
-6
lines changed
lib/passport-http-oauth/strategies Expand file tree Collapse file tree 2 files changed +13
-6
lines changed Original file line number Diff line number Diff line change @@ -144,9 +144,12 @@ ConsumerStrategy.prototype.authenticate = function(req) {
144144
145145 if ( req . headers && req . headers [ 'authorization' ] ) {
146146 var parts = req . headers [ 'authorization' ] . split ( ' ' ) ;
147- if ( parts . length == 2 ) {
148- var scheme = parts [ 0 ]
149- , credentials = parts [ 1 ] ;
147+ if ( parts . length >= 2 ) {
148+ var scheme = parts [ 0 ] ;
149+ var credentials = null ;
150+
151+ parts . shift ( ) ;
152+ credentials = parts . join ( ' ' ) ;
150153
151154 if ( / O A u t h / i. test ( scheme ) ) {
152155 params = utils . parseHeader ( credentials ) ;
@@ -233,6 +236,7 @@ ConsumerStrategy.prototype.authenticate = function(req) {
233236 return self . success ( consumer , info ) ;
234237 } ) ;
235238 } else {
239+
236240 // An `oauth_token` is present, containing a request token. In order to
237241 // validate the request, the corresponding token secret needs to be
238242 // retrieved. The application can supply additional `info` about the
Original file line number Diff line number Diff line change @@ -136,9 +136,12 @@ TokenStrategy.prototype.authenticate = function(req) {
136136
137137 if ( req . headers && req . headers [ 'authorization' ] ) {
138138 var parts = req . headers [ 'authorization' ] . split ( ' ' ) ;
139- if ( parts . length == 2 ) {
140- var scheme = parts [ 0 ]
141- , credentials = parts [ 1 ] ;
139+ if ( parts . length >= 2 ) {
140+ var scheme = parts [ 0 ] ;
141+ var credentials = null ;
142+
143+ parts . shift ( ) ;
144+ credentials = parts . join ( ' ' ) ;
142145
143146 if ( / O A u t h / i. test ( scheme ) ) {
144147 params = utils . parseHeader ( credentials ) ;
You can’t perform that action at this time.
0 commit comments