Skip to content

Commit

Permalink
ch 3, ex 1 - fixed issue with nosql (oauthinaction#14)
Browse files Browse the repository at this point in the history
  • Loading branch information
artursudnik committed Oct 7, 2019
1 parent 2a1f934 commit 02962ab
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 25 deletions.
24 changes: 12 additions & 12 deletions exercises/ch-3-ex-1/package.json
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
{
"dependencies": {
"express": "^4.13.1",
"sync-request": "^2.0.1",
"body-parser": "^1.13.2",
"underscore": "^1.8.3",
"underscore.string": "^3.1.1",
"consolidate": "^0.13.1",
"qs": "^4.0.0",
"randomstring": "^1.0.7",
"nosql": "^3.0.3",
"cors": "^2.7.1"
}
"dependencies": {
"express": "^4.13.1",
"sync-request": "^2.0.1",
"body-parser": "^1.13.2",
"underscore": "^1.8.3",
"underscore.string": "^3.1.1",
"consolidate": "^0.13.1",
"qs": "^4.0.0",
"randomstring": "^1.0.7",
"nosql": "^6.1.0",
"cors": "^2.7.1"
}
}
26 changes: 13 additions & 13 deletions exercises/ch-3-ex-1/protectedResource.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,19 +35,19 @@ var getAccessToken = function(req, res, next) {
}

console.log('Incoming token: %s', inToken);
nosql.one(function(token) {
if (token.access_token == inToken) {
return token;
}
}, function(err, token) {
if (token) {
console.log("We found a matching token: %s", inToken);
} else {
console.log('No matching token was found.');
}
req.access_token = token;
next();
return;
nosql.one().make(function(builder) {
builder.where('access_token', inToken);
builder.callback(function(err, response) {
console.log(response);
if (response) {
console.log("We found a matching token: %s", inToken);
} else {
console.log('No matching token was found.');
};
req.access_token = response;
next();
return;
})
});
};

Expand Down

0 comments on commit 02962ab

Please sign in to comment.