Skip to main content

What is the difference between the 2 websites below?


  1. Dashboard

  2. Dashboard

Which one I should use to make sh_client_id and sh_client_secret parameters as my OAuth credentials?


Please check out the Github link below, elaborating this issue:

…sentinel-hub/sentinelhub-py/issues/492

These are two separate deployments of Sentinel Hub.

First one is stand-alone, second one is part of Copernicus Data Space Ecosystem. From the feature point of view they are almost the same, the biggest difference probably being that Copernicus Data Space Ecosystem does not support Landsat Collection 2 yet.

Copernicus Data Space Ecosystem also has a permanently free tier available, within specified quotas.


You can use either of these two, just make sure you use it consistently, i.e. the service end-points should be either:



Okay thanks.


In the code below. My client_id is wrong. However I can use in the curl command and get a token:


import os
import datetime
import numpy as np
import matplotlib.pyplot as plt
import pandas as pd
import requests
import getpass

from sentinelhub import (
SHConfig,
DataCollection,
SentinelHubCatalog,
SentinelHubRequest,
BBox,
bbox_to_dimensions,
CRS,
MimeType,
Geometry,
)

from utils import plot_image

config = SHConfig("my-profile")
aoi_coords_wgs84 = [4.20762, 50.764694, 4.487708, 50.916455]
resolution = 10
aoi_bbox = BBox(bbox=aoi_coords_wgs84, crs=CRS.WGS84)
aoi_size = bbox_to_dimensions(aoi_bbox, resolution=resolution)

print(f"Image shape at {resolution} m resolution: {aoi_size} pixels")
catalog = SentinelHubCatalog(config=config)

aoi_bbox = BBox(bbox=aoi_coords_wgs84, crs=CRS.WGS84)
time_interval = "2022-07-01", "2022-07-20"



search_iterator = catalog.search(
DataCollection.SENTINEL2_L2A,
bbox=aoi_bbox,
time=time_interval,
fields={"include": ["id", "properties.datetime"], "exclude": []},
)

results = list(search_iterator)
print("Total number of results:", len(results))

Hi @ah.nikfal can you confirm that when you create your profile specific to Copernicus Data Space Ecosystem you are inputting all of the below parameters?


config = SHConfig()
config.sh_client_id = getpass.getpass("Enter your SentinelHub client id")
config.sh_client_secret = getpass.getpass("Enter your SentinelHub client secret")
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")

It’s important to set the token url and base url parameters as the default parameters for sentinelhub-py won’t work with Copernicus Data Space Ecosystem.


For some up to date examples on using sentinelhub-py with Copernicus Data Space Ecosystem I would recommend going through this notebook.


Hi, Problem solved. Thanks for mentioning those critical points.

I had not set config.sh_token_url and config.sh_base_url in my config.toml (no need to config.save("cdse") for my case). So they had some other addresses (https://services.sentinel-hub.com/oauth/token and https://services.sentinel-hub.com).

I wonder if it was necessary to establish two separate services (services.sentinel-hub.com and sh.dataspace.copernicus.eu)? It was a bit confusing for me as the user.


Thank you for your feedback @ah.nikfal , indeed we are working on improving the documentation so that it is clearer for users such as yourself on how to configure your credentials if you are using the Copernicus Data Space Ecosystem.


Hi,

I also started getting this auth error today (worked until yesterday)
“oauthlib.oauth2.rfc6749.errors.UnauthorizedClientError: (unauthorized_client) Invalid client or Invalid client credentials”

What do i need to add to my python code?

I used the following ,

config = SHConfig()
config.instance_id = INSTANCE_ID
config.sh_client_id = SH_CLIENT_ID
config.sh_client_secret = SH_CLIENT_SECRET

regards


Likely related to this update. Please regenerate your credentials and if the issue still persists then let us know.


Thx!

i created a new Oauth client with new strings and it seems to work .


we can close this


Reply