Trouble using client id / client secret in python

I am trying to use the following Python code to send a process request. I have set up a new client ID / cleint secret via my dashboard.

config = SHConfig()

config.sh_client_id = "<my client id>"
config.sh_client_secret = "<my client secret>"
Then set up a request
request_true_color = SentinelHubRequest(
    evalscript=evalscript_plants,
    input_data=[
        SentinelHubRequest.input_data(
            data_collection=DataCollection.SENTINEL2_L1C,
            time_interval=("2019-04-22", "2019-04-23"),
        )
    ],
    responses=[SentinelHubRequest.output_response("default", MimeType.PNG)],
    bbox=betsiboka_bbox,
    size=betsiboka_size,
    config=config,
)

When I make a call with the request e.g.
true_color_imgs = request_true_color.get_data()

I get an error:

Server response: “{“status”: 401, “reason”: “Unauthorized”, “message”: “You are not authorized! Please provide a valid access token within the header [Authorization: Bearer ] of your request.”, “code”: “COMMON_UNAUTHORIZED”}”

I do not know if I need to set the sh_base_url or any of the other token / authentication URLs in the config - perhaps this is the problem?

I tried setting sh_base_url to config.sh_base_url = “https://sh.dataspace.copernicus.eu/

then I get the error:

InvalidClientError: (invalid_client) Invalid client or Invalid client credentials.

Perhaps I need to match the auth token URL to this base URL?

TIA

Hi @sarah.saunders ,

I assume you are a Copernicus Data Space Ecosystem user. If this is the case, please try the following.

I hope this resolve the issue.

THank you - it gave me a clue as to the error!

I was in fact using sentinel data. So it was in sentinelHub that I needed to create my client ID / client secret, whereas I had created them in the link you shared (copernicus account).
With the SentinelHub client ID / client secret and no changes to the URLs, I can connect.