diff --git a/lib/strategy.js b/lib/strategy.js index 8a7f691..60ad54a 100644 --- a/lib/strategy.js +++ b/lib/strategy.js @@ -174,8 +174,7 @@ OAuth2Strategy.prototype.authenticate = function(req, options) { self._oauth2.getOAuthAccessToken(code, params, function(err, accessToken, refreshToken, params) { - if (err) { return self.error(self._createOAuthError('Failed to obtain access token', err)); } - if (!accessToken){ return self._createOAuthError('Failed to obtain access token', err)} + if (err || !accessToken) { return self.error(self._createOAuthError('Failed to obtain access token', err)); } self._loadUserProfile(accessToken, function(err, profile) { if (err) { return self.error(err); }