There are no tags associated with this article.

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://identity.cloudferro.com/auth/realms/DIAS/protocol/openid-connect/token' | \
                             python3 -m json.tool | grep "access_token" | awk -F\" '{print $4}')

c) By Python script

import json
import requests

def get_keycloak(username: str, password: str) -> str:
    data = {
        "client_id": "CLOUDFERRO_PUBLIC",
        "username": username,
        "password": password,
        "grant_type": "password",
        r = requests.post(
    except Exception as e:
        raise Exception(
            f"Keycloak token creation failed. Reponse from the server was: {r.json()}"
    return r.json()["access_token"]

keycloak_token = get_keycloak(username, password)