Pass custom values after auth redirect

For example this is my url for user login page:

I’d like to add some custom values, for example (just add one query paramter)


Can later I obtain this value (key=val)?
After success login I got redirect to:


code is valid - with this code I can obtain tokens (access, refresh etc).
But how can I (is it possible) to obtain my custom vars?

Your approach is correct, but you need to urlencode the redirect_uri:


should be


And after encode I will receive my custom values in URL after redirect?


I got Invalid parameter: redirect_uri error

How are your “Valid Redirect URIs” specified in the Client? If you only have http://localhost:8080, it will give you that error. If you have http://localhost:8080/*, it will work properly.

Now it works thanks!
BTW maybe you could know. Can I update user’s email with login form?
Some user have an account, then the user wants to update his email with oauth2 (via github, google etc)/
Is it possible?

Users can change their email in the account UI if you are using the keycloak javascript you can get the url for that by doing keycloak.accountManagement()

No, I want to update user’s email for already registered in KeyCloak user with external identity providers.
For example:

  1. User registered by common registration form (with email, password etc).
  2. Then this user decided to update his email with github, google etc