How to generate KeyCloak token?

a) Using web browser console

1. Open your web browser and enter https://finder.creodias.eu/www/ in the address field.

 

2. Click on “Log In” button located in the upper-right-corner.

 

3. Fill in the blanks with your e-mail address and password.

 

4. Press “Login”.

 

5. Click somewhere on the site with the right mouse button and choose “Inspect Element”.

 

6. Change your view side from Inspector to Console.

 

 

7. Click on the white space beside the blue arrow to start typing.

 

8. Type in keycloak.token and press enter in order to generate your token.


b) By query with cURL

This case has been presented in the How to order products using Finder API already. CURL is a tool to send data to the server using several protocols such as HTTP. In this example, the output is being filtred by grep and awk commands to obtain a token. In the Linux operating system it's being seen as environmental variable KEYCLOAK_TOKEN.

export KEYCLOAK_TOKEN=$(curl -d 'client_id=CLOUDFERRO_PUBLIC' \
                             -d "username=${OS_USERNAME}" \
                             -d "password=${OS_PASSWORD}" \
                             -d 'grant_type=password' \
                             'https://auth.creodias.eu/auth/realms/DIAS/protocol/openid-connect/token' | \
                             python -m json.tool | grep "access_token" | awk -F\" '{print $4}')