How to generate keycloak token on CREODIAS


a) Using web browser console

  1. Open your web browser and enter in the address field.

  1. Click on Log In button located in the upper-right-corner.

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

  1. Press “Login”.

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

  1. Change your view side from Inspector to Console.

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

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


b) By query with cURL

This case has already been presented in article: How to order products using Finder API on CREODIAS.

CURL is a tool to send data to the server using several protocols such as HTTP. In this example, the output is being filtered 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' \
                             '' | \
                             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 =
    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)