Last active
February 5, 2025 08:44
-
-
Save vodolaz095/d93839528ee95d098af95b5fa091d814 to your computer and use it in GitHub Desktop.
Makefile: obtain jwt token from keycloack and make requests via curl using this token
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# obtain keycloack jwt token and store in in variable | |
export token=$(shell curl -s -k -X POST \ | |
-d 'grant_type=password' \ | |
-d 'username=somebody' \ | |
-d 'password=longPasswordToMakeHackersSad333222111' \ | |
-d 'scope=email%20profile%20openid' \ | |
-d 'client_id=somebody' \ | |
-d 'client_secret=""' \ | |
--connect-timeout 5 \ | |
https://keycloack.local/oidc/realms/something/protocol/openid-connect/token | jq '.["access_token"]') | |
export bearer="Authorization: Bearer $(token)" | |
export api_server="http://localhost:3000/" | |
# send request to backend, performing Bearer authorization with keycloack token obtained | |
integration/get_something: | |
curl -s -H $(bearer) $(api_server)api/v1/get_something/ | jq |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment