When I use the official example (as shown in the Python code below), I consistently encounter the following error: oauthlib.oauth2.rfc6749.errors.InvalidClientError: (invalid_client) Invalid client or Invalid client credentials
.
Despite changing the OAuth clients
twice, the issue persists.
I registered with Sentinelhub, not the Copernicus Data Space Ecosystem, and I am using sentinelhub == 3.10.2
with python == 3.9.5
.
Can anyone help me resolve this problem? Thank you very much.
from sentinelhub import SHConfig
from sentinelhub import (
CRS,
BBox,
DataCollection,
MimeType,
SentinelHubRequest,
bbox_to_dimensions,
)
if __name__ == '__main__':
config = SHConfig()
config.instance_id = 'USER INSTANCE ID'
config.sh_client_id = 'sh_client_id'
config.sh_client_secret = 'sh_client_secret'
config.save()
if not config.sh_client_id or not config.sh_client_secret:
print("Warning! To use Process API, please provide the credentials (OAuth client ID and client secret).")
betsiboka_coords_wgs84 = (46.16, -16.15, 46.51, -15.58)
resolution = 60
betsiboka_bbox = BBox(bbox=betsiboka_coords_wgs84, crs=CRS.WGS84)
betsiboka_size = bbox_to_dimensions(betsiboka_bbox, resolution=resolution)
print(f"Image shape at {resolution} m resolution: {betsiboka_size} pixels")
evalscript_true_color = """
//VERSION=3
function setup() {
return {
input: [{
bands: ["B02", "B03", "B04"]
}],
output: {
bands: 3
}
};
}
function evaluatePixel(sample) {
return [sample.B04, sample.B03, sample.B02];
}
"""
request_true_color = SentinelHubRequest(
evalscript=evalscript_true_color,
input_data=[
SentinelHubRequest.input_data(
data_collection=DataCollection.SENTINEL2_L1C,
time_interval=("2020-06-12", "2020-06-13"),
)
],
responses=[SentinelHubRequest.output_response("default", MimeType.PNG)],
bbox=betsiboka_bbox,
size=betsiboka_size,
config=config,
)
true_color_imgs = request_true_color.get_data()