Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: wrong keycloak client name for authentication #5

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

becknik
Copy link

@becknik becknik commented Jan 19, 2025

Fixes #4 in the docker environment

Before change:

python3 ./get_session_token.py --local
Username: <username>
Password: <password>
Traceback (most recent call last):
  File "/home/jnnk/devel/uni/forpro/backend/demo_scripts/./get_session_token.py", line 74, in <module>
    user_token = get_auth_token(args.username, args.password, args.use_local)
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/jnnk/devel/uni/forpro/backend/demo_scripts/./get_session_token.py", line 55, in get_auth_token
    with urllib.request.urlopen(req, context=ctx) as response:
         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/nix/store/kjgslpdqchx1sm7a5h9xibi5rrqcqfnl-python3-3.12.8/lib/python3.12/urllib/request.py", line 215, in urlopen
    return opener.open(url, data, timeout)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/nix/store/kjgslpdqchx1sm7a5h9xibi5rrqcqfnl-python3-3.12.8/lib/python3.12/urllib/request.py", line 521, in open
    response = meth(req, response)
               ^^^^^^^^^^^^^^^^^^^
  File "/nix/store/kjgslpdqchx1sm7a5h9xibi5rrqcqfnl-python3-3.12.8/lib/python3.12/urllib/request.py", line 630, in http_response
    response = self.parent.error(
               ^^^^^^^^^^^^^^^^^^
  File "/nix/store/kjgslpdqchx1sm7a5h9xibi5rrqcqfnl-python3-3.12.8/lib/python3.12/urllib/request.py", line 559, in error
    return self._call_chain(*args)
           ^^^^^^^^^^^^^^^^^^^^^^^
  File "/nix/store/kjgslpdqchx1sm7a5h9xibi5rrqcqfnl-python3-3.12.8/lib/python3.12/urllib/request.py", line 492, in _call_chain
    result = func(*args)
             ^^^^^^^^^^^
  File "/nix/store/kjgslpdqchx1sm7a5h9xibi5rrqcqfnl-python3-3.12.8/lib/python3.12/urllib/request.py", line 639, in http_error_default
    raise HTTPError(req.full_url, code, msg, hdrs, fp)
urllib.error.HTTPError: HTTP Error 401: Unauthorized

After change:

python3 ./get_session_token.py --local
Username: <username>
Password: <password>
Your user token:
eyJhbGciOiJSUzI1NiIsInR5cCIgOiAiSldUIiwia2lkIiA6ICJ6NU5FcmxjYzdjSHNMQ05zWXFmb21NQ3NOQ3dTOHZpWEMwN21lQ0lEcmlnIn0.eyJleHAiOjE3MzcyODQwMDIsImlhdCI6MTczNzI4MzcwMiwianRpIjoiYTM4MmZjMmItYzFjMS00MjUwLThmZDAtNjliMGUwY2MwN2EwIiwiaXNzIjoiaHR0cDovL2xvY2FsaG9zdDo5MDA5L3JlYWxtcy9HSVRTIiwiYXVkIjoiYWNjb3VudCIsInN1YiI6IjYzOWE0MDdjLWQyMzktNDVlMS05MTI3LTkyMmUyYmY2ZDM1OSIsInR5cCI6IkJlYXJlciIsImF6cCI6ImZyb250ZW5kIiwic2Vzc2lvbl9zdGF0ZSI6ImEzMzllOTlkLTFiMDYtNDlkNS04NTRjLTlkZjY1YTc4YTJkNyIsImFjciI6IjEiLCJhbGxvd2VkLW9yaWdpbnMiOlsiaHR0cDovL2xvY2FsaG9zdDozMDA1Il0sInJlYWxtX2FjY2VzcyI6eyJyb2xlcyI6WyJvZmZsaW5lX2FjY2VzcyIsImRlZmF1bHQtcm9sZXMtZ2l0cyIsInVtYV9hdXRob3JpemF0aW9uIl19LCJyZXNvdXJjZV9hY2Nlc3MiOnsiYWNjb3VudCI6eyJyb2xlcyI6WyJtYW5hZ2UtYWNjb3VudCIsIm1hbmFnZS1hY2NvdW50LWxpbmtzIiwidmlldy1wcm9maWxlIl19fSwic2NvcGUiOiJlbWFpbCBwcm9maWxlIiwic2lkIjoiYTMzOWU5OWQtMWIwNi00OWQ1LTg1NGMtOWRmNjVhNzhhMmQ3IiwiZW1haWxfdmVyaWZpZWQiOmZhbHNlLCJuYW1lIjoiU3RlZmZlbiBCZWNrZXIiLCJwcmVmZXJyZWRfdXNlcm5hbWUiOiJiZWNrZXIiLCJnaXZlbl9uYW1lIjoiU3RlZmZlbiIsImZhbWlseV9uYW1lIjoiQmVja2VyIiwiZW1haWwiOiJhQGIuZGUifQ.Ur9ejfnrjBqncfB_4vALAzhoy8VoLfUMc-xjHsK2RwPW-AvPMP6AAjgb6pItZyFBB2mltWcJ-9Ec_xw5eEk9BrVAKWm58UPT_7iTSP3Equa9vxyoByRuXDmCudRB1nShy0WGmpvsKW7vRA9yydw4LJfLCWpcPm__Tq5qtF07UdeNxuYnd5E2EOUgAuhEpNAKli3dKtKsQWuUUjl616uDV4YtdjFfQJtRMUn9uPOxILXPk6Sc5UekAObV0ZzeRhJShQ2uvnW-R7BbRGIvzmp8KRfWmAq92vrlR4BJ3Vafzl_4NmWOC7CkdrjWBn2ZUUk1E2tfEozPuBTDhakvmGnrfQ

@becknik becknik requested a review from myluki2000 January 20, 2025 17:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Docker container client name diverged from name in git_session_token.py
1 participant