Skip to main content
1 of 3

Google Earth Engine ee.data.authenticateViaPrivateKey in Node.js not working

I'm using visual studio code to develop a web application that monitors air quality using google earth engine. The issue I'm having is that the authentication is not working. I already tried the instructions in the google earth engine NPM installation guide but that doesn't work either.

here my code:

var ee = require('@google/earthengine');
var privateKey = require('./privatekey.json');
var client_email = "email"
ee.data.authenticateViaPrivateKey(
{client_email, privateKey},
() => console.log('Authentication succeeded'),
error => console.error('Authentication failed:')

)

I know the issue is not the value of the client_email variable. I just changed it here just in case. The error shows error displayed

I don't know if this is relevant information but I'm also using Browserify so that my main.js script would work since it previously displayed a "require not defined error" Thanks for any help in advance.