Prerequisites
You must have Events enabled within Keycloak to track login events.- Log in to Keycloak as an administrator.
- Select Events from the left-hand navigation, then open the Config tab.
-
Verify the Save Events toggle is set to
ON
.
Querying the Keycloak API
-
Open a terminal. Generate a temporary token and store it as an enviornment variable for the Keycloak API by running the following command:
This temporary token expires after 60 seconds, and the next command needs to be entered before the token expires! Don’t worry though, you can always generate another temporary token, if necessary.You can verify that your command generated a token by running the command
echo $TKN
. -
Query the Keycloak API for
LOGIN
events by running the following command:
Example
Let’s say your Anaconda Server URL ishttps://data_science_snakes.anaconda.com
, and your Keycloak administrator’s username is admin and their password is password.
Once you’ve verified that Keycloak is saving user login events, request a temporary token from the Keycloak API with the following command:
