Repository navigation
How to handle missing redirect_uri in token request for Keycloak OAuth integration? #39368
Unanswered
StopDragon
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
I'm integrating Naver Works with Keycloak via OAuth 2.0 using the authorization_code grant.
The login flow fails during the /token exchange with the following Keycloak error:
2025-04-30 11:56:26,668 WARN [org.keycloak.events] (executor-thread-28) type="CODE_TO_TOKEN_ERROR", realmId="4e3e9cab-a720-4807-a247-14c5164eb0ec", realmName="*****", clientId="*****", userId="1e84e1c4-cc76-4448-8451-77c18c012dd3", sessionId="9c4d4a81-ccc3-49c9-b408-7f52731ab1bf", ipAddress="*********", error="invalid_redirect_uri", reason="Parameter 'redirect_uri' did not match originally saved redirect URI used in initial OIDC request. Saved redirectUri: https://auth.worksmobile.com/view/oauth/sso/authorization/U44BZ771, redirectUri parameter: null", grant_type="authorization_code", code_id="9c4d4a81-ccc3-49c9-b408-7f52731ab1bf", client_auth_method="client-secret"error="invalid_redirect_uri", reason="Parameter 'redirect_uri' did not match originally saved redirect URI used in initial OIDC request. Saved redirectUri: ..., redirectUri parameter: null"
However, Naver Works does not include redirect_uri in its token request by design, and this behavior cannot be changed.
This causes Keycloak to reject the token exchange due to strict matching of the redirect_uri.
Attempts so far:
Valid Redirect URIs set to * in Keycloak → still fails
Keycloak version: 26.x
Cannot change Naver Works behavior
What I'm looking for:
Any official or supported workaround in Keycloak (e.g., relaxing redirect_uri validation)?
Can I use a reverse proxy or Cloudflare Worker to inject the redirect_uri before the token request reaches Keycloak?
Is it possible to extend or customize Keycloak behavior for this specific client?
Thanks in advance.
All reactions