Skip to content

Conversation

@GalMunGral
Copy link
Collaborator

Closes #1246

How to test:

  1. Change app/config.py:
- auth_redirect_uri = f"{API_HOST}{API_V2_STR}/auth"
+ auth_redirect_uri = f"{API_HOST}{API_V2_STR}/auth/token"
  1. In Keycloak admin console, under the client "Access settings", change "Valid redirect URIs" to "http://localhost:8000/api/v2/auth/token"
  2. Click "log in" on the frontend. You should see the JSON returned by this endpoint, which includes access and refresh tokens. This is just to trigger a call to the endpoint with a valid authorization code. In a real scenario, we'd configure Keycloak to redirect to another app (e.g. IDOT TREC) with the auth code, which would in turn call this endpoint with the same auth code.

Copy link
Member

@longshuicy longshuicy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code looks good and everything works for me.

If you'd like to test, instead of hard coding the auth_redirect_uri to /token, alternatively you can set this as an env in pycharm. (But you still have to add this to the allowed redirect url in keycloak)
Pasted Graphic 25

@longshuicy longshuicy merged commit 5ea5c49 into main Nov 14, 2025
6 checks passed
@longshuicy longshuicy deleted the 1246-add-new-token-endpoint-wrapping-keycloak-token-endpoint branch November 14, 2025 03:59
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.

Add new token endpoint wrapping Keycloak token endpoint

3 participants