Skip to content

Commit 660f586

Browse files
author
Michael Salinger
committed
Changed handleResponse to use res.redirect instead of manually set location header
1 parent ade1ca4 commit 660f586

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

index.js

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -119,10 +119,18 @@ ExpressOAuthServer.prototype.token = function(options) {
119119
/**
120120
* Handle response.
121121
*/
122-
123122
var handleResponse = function(req, res, response) {
124-
res.set(response.headers);
125-
res.status(response.status).send(response.body);
123+
124+
if (response.status === 302) {
125+
var location = response.headers.location;
126+
delete response.headers.location;
127+
res.set(response.headers);
128+
res.redirect(location);
129+
}
130+
else {
131+
res.set(response.headers);
132+
res.status(response.status).send(response.body);
133+
}
126134
};
127135

128136
/**

0 commit comments

Comments
 (0)