Skip to main content

Sh_client_id and sh_client_secret ValueError

  • April 17, 2024
  • 7 replies
  • 0 views

I selcted a 5x5 patch from the AOI and I wanted to download sentinel data to work with. I tried the following code:

band_names=['B02', 'B03', 'B04', 'B08', 'B11', 'B12']
add_data = SentinelHubInputTask(
    bands_feature=(FeatureType.DATA, 'BANDS'),
    bands = band_names,
    resolution=10,
    maxcc=0.2,
    time_difference=datetime.timedelta(minutes=120),
    data_source=DataSource.SENTINEL2_L1C,
    additional_data=[(FeatureType.MASK, 'dataMask', 'IS_DATA'),
                     (FeatureType.MASK, 'CLM'),
                     (FeatureType.DATA, 'CLP')])

This is the Workflow:

workflow = LinearWorkflow(
     add_data,
     NDVI,
     NDWI,
     NDBI,
     add_sh_valmask,
     count_val_sh,
     #rasterization_task,
     save)

Executing the workflow:

time_interval = ['2019-01-01', '2019-12-31'] # time interval for the SH request

# define additional parameters of the workflow
execution_args = []
for idx, bbox in enumerate(bbox_list[patchIDs]):
    execution_args.append({
        add_data:{'bbox': bbox, 'time_interval': time_interval},
        save: {'eopatch_folder': f'eopatch_{idx}'}
    })
    
executor = EOExecutor(workflow, execution_args, save_logs=True)
executor.run(workers=12, multiprocess=False)

executor.make_report()

When I checked the result I found a folder with 25 txt files:


and each contain this:

I am supposed to get 25 eopatches. I don’t know what went wrong.
This is the html report:

Also:

So basically, from what I understand, it’s a problem related to these two:
sh_client_id: User’s OAuth client ID for Sentinel Hub service
sh_client_secret: User’s OAuth client secret for Sentinel Hub service
But how can I fix this?
Note I have already got those info ( sh_client_id and `sh_client_secret’ ) from my sentinelhub dashboard, but I still get the same error.

7 replies

Please don’t post your credentials here, as they are not really meant to be shared unless you’d like others to use them 🙂

I am pretty sure your client secret is not set correctly. The commented out sentinelhub.config --sh_client_secret has empty spaces in it. You should also wrap it in double quotes, e.g.

!sentinelhub.config --sh_client_secret "secret"

Already did this and still got the exact same errors


Please see how to configure the client on sentinelhub-py readthedocs here.


The error tells is in the message. Please check that you have set up the client id and secret correctly.


I tried that and I got this error now.


I had the same issue because I was confusing WMS_id : instance_id with oauth_id : sh_client_id


I did set it up the way you told me