# Pass custom values after auth redirect

**URL:** <https://forum.keycloak.org/t/pass-custom-values-after-auth-redirect/12901>\
**Category:** Miscellanaeous\
**Created:** [January 5, 2022, 8:18pm UTC](https://forum.keycloak.org/t/pass-custom-values-after-auth-redirect/12901 "2022-01-05T20:18:31Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![hound672](https://avatars.discourse-cdn.com/v4/letter/h/2bfe46/32.png) [@hound672](https://forum.keycloak.org/u/hound672)\
**Post date:** [January 5, 2022, 8:18pm UTC](https://forum.keycloak.org/t/pass-custom-values-after-auth-redirect/12901/1 "2022-01-05T20:18:31Z")

</div>

Hello.  
For example this is my url for user login page:  
`http://keycloak.loc:8090/auth/realms/demo/protocol/openid-connect/auth?response_type=code&client_id=Android-product&redirect_uri=http://localhost:8080`

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

```auto
http://keycloak.loc:8090/auth/realms/demo/protocol/openid-connect/auth?response_type=code&client_id=Android-product&redirect_uri=http://localhost:8080&key=val

```

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

```auto
http://localhost:8080/?session_state=47174ec8-c363-4db9-b291-804db2bca77f&code=8e88a5cf-ba65-4f35-b88a-a764e3088824.47174ec8-c363-4db9-b291-804db2bca77f.3c187c21-3cf1-4b8c-bdca-9c3be4b812c9

```

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?

---

<div class="post-metadata">

**Author:** ![xgp](https://yyz2.discourse-cdn.com/free1/user_avatar/forum.keycloak.org/xgp/32/2589_2.png) [@xgp](https://forum.keycloak.org/u/xgp)\
**Post date:** [January 5, 2022, 9:00pm UTC](https://forum.keycloak.org/t/pass-custom-values-after-auth-redirect/12901/2 "2022-01-05T21:00:51Z")

</div>

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

`http://localhost:8080&key=val`

should be

`http%3A%2F%2Flocalhost%3A8080%26key%3Dval`

---

<div class="post-metadata">

**Author:** ![hound672](https://avatars.discourse-cdn.com/v4/letter/h/2bfe46/32.png) [@hound672](https://forum.keycloak.org/u/hound672)\
**Post date:** [January 5, 2022, 9:24pm UTC](https://forum.keycloak.org/t/pass-custom-values-after-auth-redirect/12901/3 "2022-01-05T21:24:07Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![hound672](https://avatars.discourse-cdn.com/v4/letter/h/2bfe46/32.png) [@hound672](https://forum.keycloak.org/u/hound672)\
**Post date:** [January 6, 2022, 3:54pm UTC](https://forum.keycloak.org/t/pass-custom-values-after-auth-redirect/12901/4 "2022-01-06T15:54:47Z")

</div>

```auto
http://keycloak.loc:8090/auth/realms/demo/protocol/openid-connect/auth?response_type=code&client_id=Android-product&redirect_uri=http%3A%2F%2Flocalhost%3A8080%26key%3Dval

```

I got `Invalid parameter: redirect_uri` error

---

<div class="post-metadata">

**Author:** ![xgp](https://yyz2.discourse-cdn.com/free1/user_avatar/forum.keycloak.org/xgp/32/2589_2.png) [@xgp](https://forum.keycloak.org/u/xgp)\
**Post date:** [January 6, 2022, 5:13pm UTC](https://forum.keycloak.org/t/pass-custom-values-after-auth-redirect/12901/5 "2022-01-06T17:13:02Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![hound672](https://avatars.discourse-cdn.com/v4/letter/h/2bfe46/32.png) [@hound672](https://forum.keycloak.org/u/hound672)\
**Post date:** [January 6, 2022, 5:24pm UTC](https://forum.keycloak.org/t/pass-custom-values-after-auth-redirect/12901/6 "2022-01-06T17:24:33Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![edewit](https://yyz2.discourse-cdn.com/free1/user_avatar/forum.keycloak.org/edewit/32/287_2.png) [@edewit](https://forum.keycloak.org/u/edewit)\
**Post date:** [January 14, 2022, 6:12am UTC](https://forum.keycloak.org/t/pass-custom-values-after-auth-redirect/12901/8 "2022-01-14T06:12:31Z")

</div>

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()`

---

<div class="post-metadata">

**Author:** ![hound672](https://avatars.discourse-cdn.com/v4/letter/h/2bfe46/32.png) [@hound672](https://forum.keycloak.org/u/hound672)\
**Post date:** [January 16, 2022, 8:38pm UTC](https://forum.keycloak.org/t/pass-custom-values-after-auth-redirect/12901/9 "2022-01-16T20:38:51Z")

</div>

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
