CS-SI / eodag

Earth Observation Data Access Gateway
https://eodag.readthedocs.io
Apache License 2.0
320 stars 44 forks source link

[URGENT] Unable to download products from CreoDIAS due to authentification change #752

Closed filippogrz closed 1 year ago

filippogrz commented 1 year ago

Describe the bug When searching for Sentinel-1 GRD products with CreoDIAS as a provider, the download command returns an error.

It seems than CreoDIAS has recently updated their website (see new website "CreoDIAS 2.0" that now requires MFA to sign in) and their authentification method through the API.

Code To Reproduce With CreoDIAS as main provider configured, search will pass successfully but download will fail:

eodag search --productType S1_SAR_GRD --start 2023-06-01 --end 2023-06-02
eodag -vvv download --search-results search_results.geojson

Output The download command will return an authentification error:

eodag.utils.exceptions.AuthenticationError: Something went wrong while trying to get access token:
Traceback (most recent call last):
  File "/home/username/.local/lib/python3.8/site-packages/eodag/plugins/authentication/keycloak.py", line 59, in authenticate
    response.raise_for_status()
  File "/home/username/.local/lib/python3.8/site-packages/requests/models.py", line 1022, in raise_for_status
    raise HTTPError(http_error_msg, response=self)
requests.exceptions.HTTPError: 400 Client Error: Bad Request for url: https://identity.cloudferro.com/auth/realms/dias/protocol/openid-connect/token
See the full error below returned by the `download` command
```sh 2023-06-28 14:37:35,395 eodag.config [INFO ] (config ) Loading user configuration from: /home/username/.config/eodag/eodag.yml 2023-06-28 14:37:35,468 eodag.core [INFO ] (core ) usgs: provider needing auth for search has been pruned because no crendentials could be found 2023-06-28 14:37:35,468 eodag.core [INFO ] (core ) aws_eos: provider needing auth for search has been pruned because no crendentials could be found 2023-06-28 14:37:35,468 eodag.core [INFO ] (core ) meteoblue: provider needing auth for search has been pruned because no crendentials could be found 2023-06-28 14:37:35,468 eodag.core [INFO ] (core ) hydroweb_next: provider needing auth for search has been pruned because no crendentials could be found 2023-06-28 14:37:35,540 eodag.core [DEBUG ] (core ) Opening product types index in /home/username/.config/eodag/.index 2023-06-28 14:37:35,546 eodag.core [INFO ] (core ) Locations configuration loaded from /home/username/.config/eodag/locations.yml 2023-06-28 14:37:35,549 eodag.core [INFO ] (core ) Downloading 20 products Downloaded products: 0%| | 0/20 [00:00 sys.exit(eodag()) File "/home/username/.local/lib/python3.8/site-packages/click/core.py", line 1130, in __call__ return self.main(*args, **kwargs) File "/home/username/.local/lib/python3.8/site-packages/click/core.py", line 1055, in main rv = self.invoke(ctx) File "/home/username/.local/lib/python3.8/site-packages/click/core.py", line 1657, in invoke return _process_result(sub_ctx.command.invoke(sub_ctx)) File "/home/username/.local/lib/python3.8/site-packages/click/core.py", line 1404, in invoke return ctx.invoke(self.callback, **ctx.params) File "/home/username/.local/lib/python3.8/site-packages/click/core.py", line 760, in invoke return __callback(*args, **kwargs) File "/home/username/.local/lib/python3.8/site-packages/click/decorators.py", line 26, in new_func return f(get_current_context(), *args, **kwargs) File "/home/username/.local/lib/python3.8/site-packages/eodag/cli.py", line 573, in download downloaded_files = satim_api.download_all(search_results) File "/home/username/.local/lib/python3.8/site-packages/eodag/api/core.py", line 1612, in download_all paths = download_plugin.download_all( File "/home/username/.local/lib/python3.8/site-packages/eodag/plugins/download/http.py", line 718, in download_all return super(HTTPDownload, self).download_all( File "/home/username/.local/lib/python3.8/site-packages/eodag/plugins/download/base.py", line 453, in download_all product.download( File "/home/username/.local/lib/python3.8/site-packages/eodag/api/product/_product.py", line 304, in download self.downloader_auth.authenticate() File "/home/username/.local/lib/python3.8/site-packages/eodag/plugins/authentication/keycloak.py", line 77, in authenticate raise AuthenticationError( eodag.utils.exceptions.AuthenticationError: Something went wrong while trying to get access token: Traceback (most recent call last): File "/home/username/.local/lib/python3.8/site-packages/eodag/plugins/authentication/keycloak.py", line 59, in authenticate response.raise_for_status() File "/home/username/.local/lib/python3.8/site-packages/requests/models.py", line 1022, in raise_for_status raise HTTPError(http_error_msg, response=self) requests.exceptions.HTTPError: 400 Client Error: Bad Request for url: https://identity.cloudferro.com/auth/realms/dias/protocol/openid-connect/token ```

Environment:

sbrunato commented 1 year ago

Hello @filippogrz and thanks for submitting this issue. creodias has moved to a new commercial service. Before the provider is updated with this new authentication service, I can suggest you to use the cop_dataspace provider with eodag (see provider registration). It will be the closest provider to the previous creodias and you should have similar results

varisht-tathya commented 1 year ago

I am facing a similar issue as well when downloading Sen 3 SLSTR products from creodias. Are there any alternate sources that give access to historical data and compatible with EODAG?

sbrunato commented 1 year ago

Hello @varisht-tathya , for Sentinel 3 SLSTR, you can try cop_dataspace, mundi or onda (also sara for australian data). See:

>>> from eodag import EODataAccessGateway
>>> dag = EODataAccessGateway()
>>> dag.available_providers("S3_SLSTR_L1RBT")
['cop_dataspace', 'creodias', 'mundi', 'onda', 'sara']