From 83a9409f8b4fa4983929120636a48f68a01c4f38 Mon Sep 17 00:00:00 2001 From: Ben Date: Thu, 23 Sep 2021 22:23:02 +0800 Subject: [PATCH] Include a check to ensure accessToken is return --- lib/strategy.js | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/strategy.js b/lib/strategy.js index 07b87f1..8a7f691 100644 --- a/lib/strategy.js +++ b/lib/strategy.js @@ -175,6 +175,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)} self._loadUserProfile(accessToken, function(err, profile) { if (err) { return self.error(err); }