Skip to content

Commit d7c35aa

Browse files
committed
Merge branch 'master' of https://github.com/tolgaakyuz/passport-http-oauth into encoding
2 parents 301b207 + 7309711 commit d7c35aa

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

lib/passport-http-oauth/strategies/consumer.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -290,7 +290,7 @@ ConsumerStrategy.prototype.authenticate = function(req) {
290290

291291
if (signatureMethod == 'HMAC-SHA1') {
292292
var key = consumerSecret + '&';
293-
if (tokenSecret) { key += tokenSecret; }
293+
if (tokenSecret) { key += utils.encode(tokenSecret); }
294294
var computedSignature = utils.hmacsha1(key, base);
295295

296296
if (signature !== computedSignature) {

lib/passport-http-oauth/strategies/token.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,7 @@ function TokenStrategy(options, consumer, verify, validate) {
117117
this._host = options.host || null;
118118
this._realm = options.realm || 'Users';
119119
this._ignoreVersion = options.ignoreVersion || false;
120+
this.req = null;
120121
}
121122

122123
/**
@@ -134,7 +135,8 @@ util.inherits(TokenStrategy, passport.Strategy);
134135
TokenStrategy.prototype.authenticate = function(req) {
135136
var params = undefined
136137
, header = null;
137-
138+
139+
this.req = req;
138140
if (req.headers && req.headers['authorization']) {
139141
var parts = req.headers['authorization'].split(' ');
140142
if (parts.length >= 2) {
@@ -220,7 +222,7 @@ TokenStrategy.prototype.authenticate = function(req) {
220222

221223
if (signatureMethod == 'HMAC-SHA1') {
222224
var key = consumerSecret + '&';
223-
if (tokenSecret) { key += tokenSecret; }
225+
if (tokenSecret) { key += utils.encode(tokenSecret); }
224226
var computedSignature = utils.hmacsha1(key, base);
225227

226228
if (signature !== computedSignature) {

0 commit comments

Comments
 (0)