https://github.com/triole/keycloak-shell-scripts
a collection of shell scripts to interact with keycloak
https://github.com/triole/keycloak-shell-scripts
keycloak shell-scripts testing
Last synced: 9 months ago
JSON representation
a collection of shell scripts to interact with keycloak
- Host: GitHub
- URL: https://github.com/triole/keycloak-shell-scripts
- Owner: triole
- Created: 2023-11-24T12:16:08.000Z (over 2 years ago)
- Default Branch: master
- Last Pushed: 2024-11-18T13:06:00.000Z (over 1 year ago)
- Last Synced: 2024-11-18T14:49:01.290Z (over 1 year ago)
- Topics: keycloak, shell-scripts, testing
- Language: Shell
- Homepage:
- Size: 31.3 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: readme.md
Awesome Lists containing this project
README
# Keycloak Shell Scripts
- [Keycloak Client Config](#keycloak-client-config)
- [Create configuration toml](#create-configuration-toml)
- [Run scripts](#run-scripts)
- [General remarks](#general-remarks)
- [Decode Base64](#decode-base64)
## Keycloak Client Config
In order to be able to retrieve tokens via curl the client's configuration in Keycloak needs to be set up accordingly. Make sure `Client authentication` is off and enable `Direct access grants` as seen below.

## Create configuration toml
Create a configuration toml inside the `configs` folder. Use `examples/conf.toml` as template. Fill it with your Keycloak's url and the required authentication data
## Run scripts
The scripts are located inside the `sh` folder. If you have multiple configuration files inside `configs` you can use a positional argument to make use of the correct toml file. The first file name that contains the given substring is used.
```shell
# display help
sh/get_user_access_token --help
# retrieve user access token
sh/get_user_access_token myconf
# retrieve and decode client access token, verbose mode
sh/get_client_access_token anotherconf -v
```
## General remarks
## Decode Base64
Use `| base64 -di` to decode base64 strings in shell. Or in the script like `sh/get_user_access_token admin | jq .access_token | sh/decode_token`.