-
Notifications
You must be signed in to change notification settings - Fork 17
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
doc idea: language agnostic step by step procedure to do OIDC auth #83
Comments
Suggestion for the content: openEO: A Guide to HTTP RequestsThe following page provides instructions on utilizing the openEO API without relying on one of the provided openEO client libraries (https://openeo.org/software.html#clients). Although these libraries streamline openEO workflow development, the flexibility of openEO extends beyond the programming languages supported by these libraries. OpenEO offers a universal API that seamlessly integrates with any programming language supporting HTTP requests. This guide walks you through the process of using the openEO API to execute batch jobs exclusively through HTTP requests. As an illustration, we'll generate variability maps for a designated area of interest using an existing openEO user-defined process available in [EOplaza](https://portal.terrascope.be/catalogue/app-details/62). Variability maps show spatial variations in crop performance within a field on a specific date, influenced by factors like soil type, hydrology, pests, diseases, or extreme weather events. While this guide focuses on generating variability maps, the principles can be applied broadly to construct and execute any openEO workflow as a batch job. PrerequisitesTo begin with openEO, you need a valid account. The openEO Platform provides users with 1000 free credits monthly. After registering on https://openeo.cloud/, you can validate your credits on the EOplaza portal:
Now, with everything set up, we can integrate the openEO API. AuthenticationFirstly, it is important to ensure authentication and obtain a valid access token for subsequent requests. While openEO supports various authentication methods, we recommend using an OpenID Connect (OIDC) provider. In this example, we recommend using the EGI provider, which aligns with the registration process. Find a list of all supported OIDC providers and their configurations at https://openeo.vito.be/openeo/credentials/oidc. Each provider also supports different grant type. Application grant types (or flows) are methods through which applications can gain an access token and by which you grant limited access to your resources to another entity without exposing credentials. Based on the need of your application, such as the level of interactivity, a different grant type could be more suitable. For use cases where processing will be done through background processes, we generally recommend using the device flow. Most programming languages supporting HTTP communication have dedicated libraries for OIDC/OAuth2.0 authentication. Due to its complexity, we highly recommend considering using a library for this functionality. You can always go to the openEO API documentation for more details on the authentication process and creating authorization headers based on the access token:
Building your openEO processing graphOpenEO operates based on [processing graphs](https://openeo.org/documentation/1.0/glossary.html#processes) representing the workflow executed on the openEO backend by chaining processes. For example: {
"variability_map_step": {
"process_id": "variability_map",
"arguments": {
"polygon": {
"type": "Polygon",
"coordinates": [
[
[5.1882865933798366, 51.25210584147581],
[5.187754425811659, 51.24935252933054],
[5.1927447419830015, 51.24894986862563],
[5.193456116324383, 51.25172551170871],
[5.1882865933798366, 51.25210584147581]
]
]
},
"date": ["2023-08-01T00:00:00Z", "2023-12-31T00:00:00Z"]
},
"result": true,
"namespace": "vito"
}
} The provided example illustrates the execution of the variability map service, defined at https://portal.terrascope.be/catalogue/app-details/62. This represents a basic processing graph containing a single step named While this example is straightforward, constructing processing graphs for more advanced workflows can be complex. Chaining different steps together and managing process arguments can be challenging. To streamline the development of advanced processing graphs, we recommend utilizing the openEO Web Editor (https://editor.openeo.org/). This online application features a graphical user interface enabling users to construct more complex processing graphs effortlessly. Users can access the full processing graph in the Code tab. Executing a batch jobOnce the openEO processing graph is ready, it can be submitted to an openEO backend to initiate the actual data processing. In this instance, our focus is on utilizing openEO batch jobs to compute variability maps for a designated time range, specified by the Executing a batch job on openEO involves several steps:
curl --location 'https://openeo.vito.be/openeo/jobs' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer [TOKEN]' \
--data '{
"title": "OpenEO API - Variability Map",
"process": {
"process_graph": {
"variability_map_step": {
"process_id": "variability_map",
"arguments": {
"polygon": {
"type": "Polygon",
"coordinates": [
[
[
5.1882865933798366,
51.25210584147581
],
[
5.187754425811659,
51.24935252933054
],
[
5.1927447419830015,
51.24894986862563
],
[
5.193456116324383,
51.25172551170871
],
[
5.1882865933798366,
51.25210584147581
]
]
]
},
"date": [
"2023-08-01T00:00:00Z",
"2023-12-31T00:00:00Z"
]
},
"result": true,
"namespace": "vito"
}
}
}
}'
curl --location --request POST 'https://openeo.vito.be/openeo/jobs/[BATCH JOB ID]/results' \
--header 'Authorization: Bearer [TOKEN]'
curl --location 'https://openeo.vito.be/openeo/jobs/[BATCH JOB ID]' \
--header 'Authorization: Bearer [TOKEN]'
curl --location 'https://openeo.vito.be/openeo/jobs/[BATCH JOB ID]/results' \
--header 'Authorization: Bearer [TOKEN]' The openEO Web Editor (https://editor.openeo.org/) serves as a valuable tool for debugging and troubleshooting any issues that may arise during the execution of openEO workflows. Upon logging in, users can access an overview of triggered batch jobs, complete with their latest status. Additionally, the platform offers the capability to view logs and download results associated with each batch job. |
A PR would be welcome. |
The official Python/R/JS clients support the openEO-way of OIDC based auth out of the box.
But sometimes we have use cases or clients that work from a different stack, e.g. Java, C#, ... and then it takes quite a bit of explanation what has to happen practically to get to valid auth headers. It's far from trivial to figure this out directly from the openEO spec if you're new to openEO
Documentation idea: a practical, language agnostic step-by-step walk-through of what should happen to obtain valid OIDC based auth headers
The text was updated successfully, but these errors were encountered: