Skip to content

Commit

Permalink
add logs
Browse files Browse the repository at this point in the history
  • Loading branch information
shiranyo committed Oct 1, 2017
1 parent a81ecd0 commit 916f2b8
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions lib/strategies/api-strategy.js
Expand Up @@ -114,16 +114,19 @@ ApiStrategy.prototype.authenticate = function(req, options) {
} else {
logger.warn("Invalid identity_token. Proceeding with access_token only");
}
return self.success(identityToken || null);
logger.debug("authentication success.");
return self.success(identityToken || null);
}).catch (function (err) {
return self.fail(buildWwwAuthenticateHeader(requiredScope, ERROR.INVALID_TOKEN), 401);
logger.debug("authentication failed due to invalid identity token.");
return self.fail(buildWwwAuthenticateHeader(requiredScope, ERROR.INVALID_TOKEN), 401);
});
} else {
logger.debug("identity_token not found. Proceeding with access_token only.");
logger.debug("authentication success: identity_token not found. Proceeding with access_token only.");
return self.success(identityToken || null);
}
}).catch (function (err) {
return self.fail(buildWwwAuthenticateHeader(requiredScope, ERROR.INVALID_TOKEN), 401);
logger.debug("authentication failed due to invalid access token.");
return self.fail(buildWwwAuthenticateHeader(requiredScope, ERROR.INVALID_TOKEN), 401);
});

// .success(user, info) - call on auth success. user=object, info=object
Expand Down

0 comments on commit 916f2b8

Please sign in to comment.