# How to pass/access optional parameters to custom actions

**URL:** <https://community.auth0.com/t/how-to-pass-access-optional-parameters-to-custom-actions/132126>\
**Category:** Get Help\
**Tags:** login-experience, new-universal-login-experience\
**Created:** [April 16, 2024, 5:18pm UTC](https://community.auth0.com/t/how-to-pass-access-optional-parameters-to-custom-actions/132126 "2024-04-16T17:18:19Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![j.clopton](https://upload.wikimedia.org/wikipedia/commons/thumb/7/7c/User_font_awesome.svg/768px-User_font_awesome.svg.png) [@j.clopton](https://community.auth0.com/u/j.clopton)\
**Post date:** [April 16, 2024, 5:18pm UTC](https://community.auth0.com/t/how-to-pass-access-optional-parameters-to-custom-actions/132126/1 "2024-04-16T17:18:19Z")

</div>

I have an spa where I am setting custom claims in onExecutePostLogin. I want to optionally pass parameters (possibly from loginWithRedirect?) from the client to add to these claims so I can then pick up from the token and use in my app. Can anyone help with this?

---

<div class="post-metadata">

**Author:** ![rueben.tiow](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/rueben.tiow/32/11646_2.png) [@rueben.tiow](https://community.auth0.com/u/rueben.tiow)\
**Post date:** [April 16, 2024, 11:37pm UTC](https://community.auth0.com/t/how-to-pass-access-optional-parameters-to-custom-actions/132126/3 "2024-04-16T23:37:51Z")

</div>

Hi @j.clopton,

Welcome to the Auth0 Community!

Unfortunately, there isn’t a way to pass additional query parameters in your login request for the Action to read them.

For now, you could append these attributes to the user’s user\_metadata as a workaround. This way, you can add these to the access token as a custom claim.

Let me know if you have any questions.

Thanks,  
Rueben

---

<div class="post-metadata">

**Author:** ![j.clopton](https://upload.wikimedia.org/wikipedia/commons/thumb/7/7c/User_font_awesome.svg/768px-User_font_awesome.svg.png) [@j.clopton](https://community.auth0.com/u/j.clopton)\
**Post date:** [April 17, 2024, 9:17pm UTC](https://community.auth0.com/t/how-to-pass-access-optional-parameters-to-custom-actions/132126/4 "2024-04-17T21:17:06Z")

</div>

Thanks for the response. The problem I am having is I think I need the custom claims to be dynamic. I want the user to be able to decide one of the values on the claim before or during the login. Is that possible?

---

<div class="post-metadata">

**Author:** ![rueben.tiow](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/rueben.tiow/32/11646_2.png) [@rueben.tiow](https://community.auth0.com/u/rueben.tiow)\
**Post date:** [April 29, 2024, 4:51pm UTC](https://community.auth0.com/t/how-to-pass-access-optional-parameters-to-custom-actions/132126/5 "2024-04-29T16:51:35Z")

</div>

Hi @j.clopton,

Thanks for your reply.

You can have dynamic custom claims, especially if the user has decided on one of the values before the login process. After they have decided on a value, you should store it in the user’s user\_metadata by using the Management API [Update a user endpoint](https://auth0.com/docs/api/management/v2/users/patch-users-by-id).

Then, when they log in, you can get the user\_metadata and append them as custom claims to the token using a [Post Login Action](https://auth0.com/docs/customize/actions/flows-and-triggers/login-flow).

Another workaround would be redirecting your users during the login process to a separate page to ask them to select their preferred value. Then, when resuming the auth flow, send that information back and append that information to the access token. See [Redirect with Actions](https://auth0.com/docs/customize/actions/flows-and-triggers/login-flow/redirect-with-actions).

Let me know how this goes for you.

Thanks,  
Rueben

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/auth0/original/3X/b/5/b560f266932fcce5d57f09a6595bd50518cae3f3.jpeg) [@system](https://community.auth0.com/u/system)\
**Post date:** [May 13, 2024, 4:52pm UTC](https://community.auth0.com/t/how-to-pass-access-optional-parameters-to-custom-actions/132126/6 "2024-05-13T16:52:34Z")

</div>

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.
