# React \<Auth0Provider/\>, how to pass params from server

**URL:** <https://community.auth0.com/t/react-auth0provider-how-to-pass-params-from-server/82430>\
**Category:** Get Help\
**Tags:** auth0\
**Created:** [April 26, 2022, 5:43pm UTC](https://community.auth0.com/t/react-auth0provider-how-to-pass-params-from-server/82430 "2022-04-26T17:43:38Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![arup.sarkar](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/arup.sarkar/32/30746_2.png) [@arup.sarkar](https://community.auth0.com/u/arup.sarkar)\
**Post date:** [April 26, 2022, 5:43pm UTC](https://community.auth0.com/t/react-auth0provider-how-to-pass-params-from-server/82430/1 "2022-04-26T17:43:38Z")

</div>

Please include the following information in your post:  
I am following [Auth0 React SDK for Single Page Apps](https://auth0.com/docs/libraries/auth0-react) instead of hard coding the domain and clientId I want to read it from server, how do I achieve it in react in

Currently, I am reading from express layer and I can console.log it in the app and everything is working fine BUT for some reason the params in Auth0Provider is not updating to the new variables from the server

```auto
                <Auth0Provider
                    domain={domain}
                    clientId={clientId}
                    redirectUri={redirecturi}
                >

```

- **Which SDK this is regarding:**  
auth0-react
- **SDK Version:**  
“@auth0/auth0-react”: “^1.10.0”,
- **Platform Version:**  
node 12.22.x

---

<div class="post-metadata">

**Author:** ![dan.woda](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/dan.woda/32/18340_2.png) [@dan.woda](https://community.auth0.com/u/dan.woda)\
**Post date:** [April 27, 2022, 4:15pm UTC](https://community.auth0.com/t/react-auth0provider-how-to-pass-params-from-server/82430/3 "2022-04-27T16:15:39Z")

</div>

Hi @arup.sarkar,

Why are you doing this? Usually you set them as environment variables.

---

<div class="post-metadata">

**Author:** ![arup.sarkar](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/arup.sarkar/32/30746_2.png) [@arup.sarkar](https://community.auth0.com/u/arup.sarkar)\
**Post date:** [April 27, 2022, 4:26pm UTC](https://community.auth0.com/t/react-auth0provider-how-to-pass-params-from-server/82430/4 "2022-04-27T16:26:25Z")

</div>

I have a .env file in my local and eventually it will be hosted in heroku. Now my express layer can easily read up from .env and get process.env.domain or process.env.clientId. Auth0Provider being in client side I was reading it in my express, exposed it via endpoint and client calling the endpoint to get it. Basically, ensuring that none of it is exposed in client.  
I found out that in react you can read environment variables [Adding Custom Environment Variables | Create React App](https://create-react-app.dev/docs/adding-custom-environment-variables/) which I will try.

---

<div class="post-metadata">

**Author:** ![dan.woda](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/dan.woda/32/18340_2.png) [@dan.woda](https://community.auth0.com/u/dan.woda)\
**Post date:** [April 27, 2022, 4:32pm UTC](https://community.auth0.com/t/react-auth0provider-how-to-pass-params-from-server/82430/5 "2022-04-27T16:32:05Z")

</div>

> [@arup.sarkar](#):
>
> Basically, ensuring that none of it is exposed in client.

These variables (`clientId`, `domain`, `redirectURI`) are not confidential. A user can easily look at the URL and see your domain, right? All they need to do is inspect the request and all of these variables are available.

The client is running on the user’s machine, and there is no way to keep data in the client safe from the user. Make sure you aren’t storing secrets, API keys, etc. Even if you are retrieving them after the fact, they could still be inspected by the user.

---

<div class="post-metadata">

**Author:** ![dan.woda](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/dan.woda/32/18340_2.png) [@dan.woda](https://community.auth0.com/u/dan.woda)\
**Post date:** [June 28, 2022, 10:29pm UTC](https://community.auth0.com/t/react-auth0provider-how-to-pass-params-from-server/82430/6 "2022-06-28T22:29:52Z")

</div>


