Hi everyone:
googleapis version: v41.0.1 Apache-2.0This is the code for account service auth
const {google} = require('googleapis');
let jwtClient = new google.auth.JWT(
"++++@+++++.iam.gserviceaccount.com",
null,
"-----BEGIN PRIVATE KEY----+++++----END PRIVATE KEY-----\n",
['https://www.googleapis.com/auth/calendar']);
//authenticate request
jwtClient.authorize(function (err, tokens) {
if (err) {
console.log(err);
} else {
console.log("Successfully connected!");
}
})
-----> err:
{...}
response: {...}
config: {...}
method: "POST"
url: "https://www.googleapis.com/oauth2/v4/token"
data: {...}
grant_type: "urn:ietf:params:oauth:grant-type:jwt-bearer"
assertion: "eyJ..............StRIBg"
headers: {...}
Content-Type: "application/x-www-form-urlencoded"
Accept: "application/json"
responseType: "json"
params: {...}
body: "{\"grant_type\":\"urn:ietf:params:oauth:grant-type:jwt-bearer\",\"assertion\":\"eyJhb4.......StRIBg\"}"
data: {...}
error: "unsupported_grant_type"
error_description: "Invalid grant_type: "
headers: {...}
alt-svc: "quic=\":443\"; ma=2592000; v=\"46,43\",h3-Q050=\":443\"; ma=2592000,h3-Q049=\":443\"; ma=2592000,h3-Q048=\":443\"; ma=2592000,h3-Q046=\":443\"; ma=2592000,h3-Q043=\":443\"; ma=2592000,h3-T050=\":443\"; ma=2592000"
cache-control: "private"
connection: "close"
content-encoding: "gzip"
content-type: "application/json; charset=utf-8"
date: "Wed, 25 Mar 2020 14:17:08 GMT"
server: "scaffolding on HTTPServer2"
transfer-encoding: "chunked"
vary: "Origin, X-Origin, Referer"
x-content-type-options: "nosniff"
x-frame-options: "SAMEORIGIN"
x-xss-protection: "0"
status: 400
statusText: "Bad Request"
request: {...}
responseURL: "https://www.googleapis.com/oauth2/v4/token"
config: {...}
method: "POST"
url: "https://www.googleapis.com/oauth2/v4/token"
data: {...}
headers: {...}
responseType: "json"
params: {...}
body: "{\"grant_type\":\"urn:ietf:params:oauth:grant-type:jwt-bearer\",\"assertion\":\"eyJh...........StRIBg\"}"
code: "400"
The code has been correctly working for months. But now appear this error.
Any ideas?
Thanks!
Same issue happening here since today (using same googleapis version as OP)
@meneale @javieranton-zz please:
rm -rf package-lock.json
rm -rf node_modules
npm i
And try again, the fact that you're setting the header content-type, application/x-www-form-urlencode suggests to me that you're on a bad version of the gaxios dependency, which was rolled back two days ago.
@meneale @javieranton-zz please:
rm -rf package-lock.json rm -rf node_modules npm iAnd try again, the fact that you're setting the header
content-type,application/x-www-form-urlencodesuggests to me that you're on a bad version of thegaxiosdependency, which was rolled back two days ago.
Can I run these command in Javascript code? I downloaded this googleapis package in my wix site directly from Github. Wix site use javascript code calling googleapis package.
@@meneale I recommend redeploying the Wix site, if that doesn't work, I would open a support ticket with Wix and ask them what to do if you have a bad entry in your package-lock.json.
Ok i tried the following steps:
I think the problem is not Wix but the package or google.
Any ideas?
@meneale could you share how you are installing this library? I believe you downloaded a copy of the library during the hour that it was having trouble yesterday. Could you re-download the library and re-add it to your project that's deploying to Wix?
Wix stores a subset of all libraries it offers to its users. Wix must have downloaded the library at the wrong time, and us users can't run any Node commands as we are limited to just JS. I unsuccesfully tried contacting them about this. They seem to update their libraries every 5-7 days. Fingers crossed that this is fixed in the next round, but I am not sure it will be. In the meantime, all our googleapi calls aren't working :(

Here the command to install the package. I've tried to unistall and reinstall it right now. Same Problem.
I managed to engage Wix support and after they updated googleapis to v48 it now works
Fantastic! Now is working. Really thanks for the help!
馃憢 I'm glad you're unblocked.
Most helpful comment
Fantastic! Now is working. Really thanks for the help!