hey tom, i had a similar issue. try clearing ur browser cache and cookies. sometimes the old auth data messes things up. also, double-check ur firewall settings - it might be blocking the redirect. if that doesnt work, maybe try a different port like 3000 instead of 8080. good luck!
I’ve been through this headache before, and it can be frustrating. Have you tried running your Node.js app with elevated privileges? Sometimes, especially on Windows, this can solve permission-related issues with localhost.
Another thing to check is your Google Cloud Console settings. Make sure you’ve enabled the Google Sheets API for your project. It’s easy to overlook this step.
If those don’t work, try using ngrok to create a secure tunnel to your localhost. This can sometimes bypass redirect issues. Just remember to update your authorized redirect URIs in the Google Cloud Console with the ngrok URL.
Lastly, double-check your scopes in the authorization request. If they don’t match exactly with what’s in your Google Cloud Console, it can cause redirect problems. Hope this helps!
I encountered a similar problem when setting up the Google Sheets API with Node.js. One solution that worked for me was to use the ‘http://localhost’ URI without specifying a port number in both the credentials.json file and the Google Cloud Console settings. This approach seemed to resolve the redirect issues.
Additionally, ensure you’re using the latest version of the google-auth-library package. Older versions sometimes have compatibility issues with the current Google OAuth flow. If you’re still facing problems, consider checking your Node.js version - I found that using Node.js v14 or higher improved compatibility with the Google APIs.
Lastly, double-check that your OAuth consent screen is properly configured in the Google Cloud Console. Sometimes, incomplete setup there can lead to unexpected errors during the authorization process.