Error 401 in combination with instance id

  • 26 April 2024
  • 3 replies

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 = ""
config.sh_base_url = """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()


Detailed Error message:

DownloadFailedException: Failed to download from:
with HTTPError:
401 Client Error: Unauthorized for url:
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!

3 replies

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 🙂

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


Planet Monitoring

© 2024 Planet Labs PBC. All rights reserved.
| Privacy Policy | California Privacy Notice | California Do Not Sell
Your Privacy Choices | Cookie Notice | Terms of Use