mirror of
https://github.com/hardillb/node-red-alexa-home-skill-web.git
synced 2025-12-19 16:51:32 +01:00
Fix oauth bug
mongoose getters not called for queries so need to explicitly check.
This commit is contained in:
3
oauth.js
3
oauth.js
@@ -42,7 +42,8 @@ server.exchange(oauth2orize.exchange.code({
|
||||
OAuth.GrantCode.findOne({ code: code }, function(error, grant) {
|
||||
if (grant && grant.active && grant.application == application.id) {
|
||||
//console.log("exchange, found grant code")
|
||||
OAuth.AccessToken.findOne({application:application, user: grant.user, active: true}, function(error,token){
|
||||
var now = new Date().getTime()
|
||||
OAuth.AccessToken.findOne({application:application, user: grant.user, expires: { $lt: now}}, function(error,token){
|
||||
if (token) {
|
||||
//console.log("Active access token found");
|
||||
//console.log("%j", token);
|
||||
|
||||
Reference in New Issue
Block a user