You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm currently working on a project where I need to access Google Sheets using the google-spreadsheet npm package. Due to restrictions, I'm based in China and using a VPN to access Google services. However, I'm encountering an issue where I'm getting the following error Error: Request to https://www.googleapis.com/oauth2/v4/token failed, reason:
Here's the relevant code snippet:
`import { JWT } from "google-auth-library";
import { GoogleSpreadsheet} from "google-spreadsheet";
const doc = new GoogleSpreadsheet(googleSheetId, serviceAccountAuth);`
I suspect this error is due to the VPN and possibly related to Google's restrictions in China. How can I resolve this issue and successfully authenticate with Google's OAuth2 service while using a VPN in China? Any insights or workaround suggestions would be greatly appreciated. Thank you!
Note: I've tested this code with a friend located in Morocco, and it works fine on their laptop without any issues.
The text was updated successfully, but these errors were encountered:
Sorry but that’s really outside the scope of this project…
But it sounds like you need to route the google requests through a proxy. This is very common in scraping applications so just search for things related to scraping, proxies, and changing countries.
Internally this tool uses axios, so I think after initializing the document, you should be able to access the axios instance and mess with the settings to inject proxy behaviour.
I'm currently working on a project where I need to access Google Sheets using the google-spreadsheet npm package. Due to restrictions, I'm based in China and using a VPN to access Google services. However, I'm encountering an issue where I'm getting the following error
Error: Request to https://www.googleapis.com/oauth2/v4/token failed, reason:
Here's the relevant code snippet:
`import { JWT } from "google-auth-library";
import { GoogleSpreadsheet} from "google-spreadsheet";
const serviceAccountAuth = new JWT({
email: creds.client_email,
key: creds.private_key,
scopes: SCOPES,
});
const doc = new GoogleSpreadsheet(googleSheetId, serviceAccountAuth);`
I suspect this error is due to the VPN and possibly related to Google's restrictions in China. How can I resolve this issue and successfully authenticate with Google's OAuth2 service while using a VPN in China? Any insights or workaround suggestions would be greatly appreciated. Thank you!
Note: I've tested this code with a friend located in Morocco, and it works fine on their laptop without any issues.
The text was updated successfully, but these errors were encountered: