...
It is recommended to do this process manually once and then use the refresh token in the script. This way we can avoid putting the user credentials in the script.
Example API Request using the Access Token
This The access_token is required to access the APIs. ExampleHere is an example request to get the list of projects from Asta7
Code Block |
---|
curl -X GET http://localhost/gui-server/api/asta7-project -H 'Authorization: Bearer eyJhbGciOiJSUzI1NiIsInR5cCIgOiAiSldUIiwia2lkIiA6ICJvMmdlVzN2a21QSldEcmppbHFuc2xTU1I1cXJ5SlVXeHZHS0RDY19QXzFzIn0.eyJleHAiOjE2ODc3NTM0NTksImlhdCI6MTY4Nzc1MzE1OSwianRpIjoiMjUzMmE2NzMtODdlYS00ODA1LTg1ODktMTc2MzJlZTk3ZGE0IiwiaXNzIjoiaHR0cDovL2xvY2FsaG9zdC9hdXRoL3JlYWxtcy9hcmNoaXZlLW1hbmFnZXIiLCJhdWQiOlsiY29yZSIsImFjY291bnQiXSwic3ViIjoiNTZlZGVmNGItNDkzMC00NTVjLWJkNzgtOWM4ZjBhZjUyZmMxIiwidHlwIjoiQmVhcmVyIiwiYXpwIjoiY2xpZW50Iiwic2Vzc2lvbl9zdGF0ZSI6IjVjNzg1ZWM2LTljM2YtNGVhNC1iMDJiLTQ4ZDlhNmIwNzk0OCIsImFjciI6IjEiLCJhbGxvd2VkLW9yaWdpbnMiOlsiaHR0cDovLzE5Mi4xNjguMi4xMTIiLCJodHRwOi8vbG9jYWxob3N0IiwiaHR0cDovL2xvY2FsaG9zdDozOTA0NSIsImh0dHA6Ly9sb2NhbGhvc3Q6MTAzMDAiLCJodHRwOi8vbG9jYWxob3N0OjQyMDAiXSwicmVhbG1fYWNjZXNzIjp7InJvbGVzIjpbImFtfHN5c3RlbV9hZG1pbiIsIm9mZmxpbmVfYWNjZXNzIiwidW1hX2F1dGhvcml6YXRpb24iXX0sInJlc291cmNlX2FjY2VzcyI6eyJjb3JlIjp7InJvbGVzIjpbImFtX3VzZXIiXX0sImFjY291bnQiOnsicm9sZXMiOlsibWFuYWdlLWFjY291bnQiLCJtYW5hZ2UtYWNjb3VudC1saW5rcyIsInZpZXctcHJvZmlsZSJdfX0sInNjb3BlIjoiZW1haWwgcHJvZmlsZSIsInNpZCI6IjVjNzg1ZWM2LTljM2YtNGVhNC1iMDJiLTQ4ZDlhNmIwNzk0OCIsImVtYWlsX3ZlcmlmaWVkIjpmYWxzZSwicHJlZmVycmVkX3VzZXJuYW1lIjoic3lzX2FkbWluIn0.Lnm2-bBLX7D0iz4nPlsvOGZ1tMct8j_1H-zgYfOKBbEEkTnTsf5Riuku_Zibr7yu-3oqp-BU0axz_NYe0uE2KpNZlm5GhBj4QddzJgiD27l8kNCbgEMXaLqKCPdTXdTHw3ZsJa8OssWspnmTVU3BR-Fv28uoyEuO-EzwRJWsKxpoGEBZibJ0_AsxrfLVG43TeeCDh1JASg7hWt2PnqHBN4DnZg3ka-sZmguulYUoDcXClirYY9YkP47IdV7HOllbG_0t144bLRaYQBMFIh92AE90s5ytAbISWuRDAxV8VaBrdc4G3HTtfZjCzzWToednfoPu7xPgPyXrn569nkuRbA' |
Expires In
This property The expires_in
property in the response states the period of validation (in seconds) for the access_token
. By default, this is 5 minutes. Can be modified from the Keycloak admin console. Log in to the Keycloak admin console then go to Realm Settings
and change the Access Token Lifespan
...