1

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')
    .filterBounds(roi)
    .filterDate('2017-05-01', '2017-06-30')
    .sort('CLOUD_COVER')
    .first();
Map.addLayer(image, {bands: ['B4', 'B3', 'B2'],min:0, max: 0.2}, 'True colour image');

Any idea why this is?

3
  • 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. Commented 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
    Commented Dec 31, 2019 at 5:15
  • 1
    This question is probably better directed at the Earth Engine Developers discussion group Commented Jan 2, 2020 at 18:01

0

Your Answer

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

Browse other questions tagged or ask your own question.