I am trying to load one surface reflectance image from Sentinel-2 MSI Level-2A in Google Earth Engine, but I get the following error:

ImageCollection (Error) Request had invalid authentication credentials. Expected OAuth 2 access token, login cookie or other valid authentication credential. See https://developers.google.com/identity/sign-in/web/devconsole-project.

Here is my code and the roi:

var roi = ee.Geometry.Point(-94.86,36.93);
var image = ee.ImageCollection('COPERNICUS/S2_SR')
    .filterDate('2017-05-01', '2017-06-30')
Map.addLayer(image, {bands: ['B4', 'B3', 'B2'],min:0, max: 0.2}, 'True colour image');

Any idea why this is?

  • 1
    I assume you run this code in your own web app and not in the ee sandbox. In the error message it kinda tells you what's wrong. your authentication isn't set up correctly. Furthermore, S2_SR isn't available in Earth Engine in 2017 on that specific location. First available would be 2018-12-13.
    – g07kore
    Dec 30, 2019 at 10:27
  • Thank you @g07kore for your response. However, I have another question, do you have any suggestions on how to fix/set up correctly my authentication?
    – Perro
    Dec 31, 2019 at 5:15
  • 1
    This question is probably better directed at the Earth Engine Developers discussion group Jan 2, 2020 at 18:01


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Browse other questions tagged or ask your own question.