# How to add data (or query param) to redirect\_uri?

**URL:** <https://community.auth0.com/t/how-to-add-data-or-query-param-to-redirect-uri/91425>\
**Category:** Get Help\
**Tags:** login, auth0\
**Created:** [September 28, 2022, 2:53am UTC](https://community.auth0.com/t/how-to-add-data-or-query-param-to-redirect-uri/91425 "2022-09-28T02:53:32Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![TheEWL](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/theewl/32/25034_2.png) [@TheEWL](https://community.auth0.com/u/TheEWL)\
**Post date:** [September 28, 2022, 2:53am UTC](https://community.auth0.com/t/how-to-add-data-or-query-param-to-redirect-uri/91425/1 "2022-09-28T02:53:32Z")

</div>

Hi,

We want to figure out a way to send data to our web app after a user logs in. Basically we want to trigger something on our web app right after a user successfully logs in. One potential solution that we thought about was to add a query parameter to the redirect uri where the user gets sent after successful login, and then use that to determine that a user just logged in.

Ex.

```auto
loginWithRedirect({
            redirectUri: `http://localhost:3001/dashboard?justLoggedIn=true`,
        });

```

or

```auto
        <Auth0Provider
            domain={AUTH0_DOMAIN}
            clientId={AUTH0_CLIENT_ID}
            redirectUri="http://localhost:3001/dashboard?justLoggedIn=true"
            audience={AUTH0_API_AUDIENCE}>

```

We noticed that this was not possible because the query params gets removed once the user is redirected. Goes to [http://localhost:3001/dashboard](http://localhost:3001/dashboard) instead of [http://localhost:3001/dashboard?name=auth](http://localhost:3001/dashboard?name=auth).

Also looked into api.redirect.sendUserTo in auth0 action but we don’t want to temporary redirect the user and go back to auth0 to continue the workflow. Is there a suggested method for achieving this? or are we doing something wrong?

---

<div class="post-metadata">

**Author:** ![ty.frith](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/ty.frith/32/58484_2.png) [@ty.frith](https://community.auth0.com/u/ty.frith)\
**Post date:** [September 30, 2022, 6:51pm UTC](https://community.auth0.com/t/how-to-add-data-or-query-param-to-redirect-uri/91425/2 "2022-09-30T18:51:00Z")

</div>

Hello @TheEWL welcome to the community!

What if you pass an object directly to `loginWithRedirect` as outlined in this post:

> [@Send custom params from auth0-spa-js loginWithRedirect() for using in rules](https://community.auth0.com/t/send-custom-params-from-auth0-spa-js-loginwithredirect-for-using-in-rules/63686/3):
>
> Hi @pratikpalse, Welcome to the Community! You need to pass an object. ({}) to the loginWithRedirect() method. You are currently passing an array ([]). For example: loginWithRedirect({foo:'bar'})

Alternatively, you could use the `appState` to achieve a similar result - As noted in the documentation:

> If you need to send custom parameters to the Authorization Server, make sure to use the original parameter name.

[https://auth0.github.io/auth0-spa-js/interfaces/redirectloginoptions.html#appstate](https://auth0.github.io/auth0-spa-js/interfaces/redirectloginoptions.html#appstate)

Hope this helps!

---

<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:** [October 14, 2022, 6:51pm UTC](https://community.auth0.com/t/how-to-add-data-or-query-param-to-redirect-uri/91425/4 "2022-10-14T18:51:55Z")

</div>

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