Skip to content

Commit b47f246

Browse files
authored
Merge pull request #22 from mjsalinger/fix-response-handler
Fix response handler
2 parents ade1ca4 + 780da2d commit b47f246

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

index.js

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -119,10 +119,17 @@ 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+
} else {
130+
res.set(response.headers);
131+
res.status(response.status).send(response.body);
132+
}
126133
};
127134

128135
/**

0 commit comments

Comments
 (0)