Error 401 in combination with instance id

Introduction: Hello everyone,

I’m a newcomer to working with satellite imagery and SentinelHub. I may need a straightforward explanation or solution, so I appreciate your patience. Despite searching extensively on Google and the forum, I haven’t found a solution to my problem.

Context: I successfully followed this Jupyter notebook for migrating from the old API to the new one. However, when attempting this Jupyter notebook for large areas, I encountered an HTTPError 401 Client Error: “You are not authorized,” despite having created the necessary instance ID token.

Problem Code Blocks: The code blocks causing the issue are found in cellblocks 15 & 16 and are look as follows in my slighlty modified version:

from sentinelhub import SHConfig
from decouple import config as credentials

config = SHConfig()

config.instance_id = credentials("POETRY_SENTINEL_INSTANCE_ID")
config.sh_client_id = credentials("POETRY_SENTINEL_CLIENT_ID")
config.sh_client_secret = credentials("POETRY_SENTINEL_CLIENT_SECRET_KEY")
config.sh_token_url = "https://identity.dataspace.copernicus.eu/auth/realms/CDSE/protocol/openid-connect/token"
config.sh_base_url = "https://sh.dataspace.copernicus.eu"
config.save("cdse")

# Saved config can be later accessed with config = SHConfig("cdse")
config = SHConfig("cdse")

tile_splitter = TileSplitter(
    [denmark_area], CRS.WGS84, ("2022-01-01", "2022-01-31"), data_collection=DataCollection.SENTINEL2_L1C, config=config
)

tile_bbox_list = tile_splitter.get_bbox_list()

print(len(tile_bbox_list))
print(tile_bbox_list[0].__repr__())
print(tile_splitter.get_info_list()[0])

Detailed Error message:

DownloadFailedException: Failed to download from:
https://services.sentinel-hub.com/api/v1/catalog/1.0.0/search
with HTTPError:
401 Client Error: Unauthorized for url: https://services.sentinel-hub.com/api/v1/catalog/1.0.0/search
Server response: "{"code": 401, "description": "You are not authorized - invalid accessToken signature."}"

Concerns: I’ve seen mentions of needing a valid subscription for this feature, but I couldn’t find any documentation confirming this. Could it be due to my free plan, or is there something else I’m missing?

I appreciate any helpful replies and insights. Thank you in advance for your assistance!

Hi David, thanks for the question. The notebook that you are running wasn’t originally written with the Copernicus Data Space Ecosystem in mind. Can you please direct your question to the Community Forum which you can find here.

We are looking into a solution for you, and will gladly answer your question over at the Copernicus Data Space Ecosystem community forum once we have found a solution.

Sure thing, thanks for taking the time to reply :slight_smile:

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.