google-auth-library
Advanced tools
Comparing version 8.5.1 to 8.5.2
@@ -17,2 +17,3 @@ "use strict"; | ||
exports.OAuth2Client = exports.CertificateFormat = exports.CodeChallengeMethod = void 0; | ||
const gaxios_1 = require("gaxios"); | ||
const querystring = require("querystring"); | ||
@@ -64,3 +65,3 @@ const stream = require("stream"); | ||
// Allow scopes to be passed either as array or a string | ||
if (opts.scope instanceof Array) { | ||
if (Array.isArray(opts.scope)) { | ||
opts.scope = opts.scope.join(' '); | ||
@@ -165,2 +166,3 @@ } | ||
async refreshTokenNoCache(refreshToken) { | ||
var _a; | ||
if (!refreshToken) { | ||
@@ -176,9 +178,21 @@ throw new Error('No refresh token is set.'); | ||
}; | ||
// request for new token | ||
const res = await this.transporter.request({ | ||
method: 'POST', | ||
url, | ||
data: querystring.stringify(data), | ||
headers: { 'Content-Type': 'application/x-www-form-urlencoded' }, | ||
}); | ||
let res; | ||
try { | ||
// request for new token | ||
res = await this.transporter.request({ | ||
method: 'POST', | ||
url, | ||
data: querystring.stringify(data), | ||
headers: { 'Content-Type': 'application/x-www-form-urlencoded' }, | ||
}); | ||
} | ||
catch (e) { | ||
if (e instanceof gaxios_1.GaxiosError && | ||
e.message === 'invalid_grant' && | ||
((_a = e.response) === null || _a === void 0 ? void 0 : _a.data) && | ||
/ReAuth/i.test(e.response.data.error_description)) { | ||
e.message = JSON.stringify(e.response.data); | ||
} | ||
throw e; | ||
} | ||
const tokens = res.data; | ||
@@ -185,0 +199,0 @@ // TODO: de-duplicate this code from a few spots |
{ | ||
"name": "google-auth-library", | ||
"version": "8.5.1", | ||
"version": "8.5.2", | ||
"author": "Google Inc.", | ||
@@ -63,3 +63,3 @@ "description": "Google APIs Authentication Client Library for Node.js", | ||
"null-loader": "^4.0.0", | ||
"puppeteer": "^16.0.0", | ||
"puppeteer": "^18.0.0", | ||
"sinon": "^14.0.0", | ||
@@ -66,0 +66,0 @@ "tmp": "^0.2.0", |
Sorry, the diff of this file is too big to display
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
492263
8206