# Can't load environment variables from .env file

**URL:** <https://community.auth0.com/t/cant-load-environment-variables-from-env-file/64059>\
**Category:** Get Help\
**Created:** [June 8, 2021, 3:23am UTC](https://community.auth0.com/t/cant-load-environment-variables-from-env-file/64059 "2021-06-08T03:23:38Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![huynhnamdo](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/huynhnamdo/32/29866_2.png) [@huynhnamdo](https://community.auth0.com/u/huynhnamdo)\
**Post date:** [June 8, 2021, 3:23am UTC](https://community.auth0.com/t/cant-load-environment-variables-from-env-file/64059/1 "2021-06-08T03:23:39Z")

</div>

Hi, I am doing my web app using create-react-app and Auth0 for my login/logout functionality. However, I run into a problem when I have to load the domain and clientId from the .env file. I console log them and both of them are undefined. When I replace “process.env.REACT\_APP\_AUTH0\_DOMAIN” and “process.env.REACT\_APP\_AUTH0\_CLIENT\_ID” with actual strings value, everything works.

Can anyone tell me why this happened and how to fix this kind of issue in order for it to use the .env file properly? Thank you

---

<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 8, 2021, 7:55pm UTC](https://community.auth0.com/t/cant-load-environment-variables-from-env-file/64059/3 "2021-06-08T19:55:07Z")

</div>

Hi @huynhnamdo,

Welcome to the Community!

In our react samples we use a json file for the configuration variable. You could try switching to this type of setup. Here is an example of the config file.

> <https://github.com/auth0-samples/auth0-react-samples/blob/master/Sample-01/src/auth_config.json.example>

---

<div class="post-metadata">

**Author:** ![huynhnamdo](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/huynhnamdo/32/29866_2.png) [@huynhnamdo](https://community.auth0.com/u/huynhnamdo)\
**Post date:** [June 9, 2021, 2:09am UTC](https://community.auth0.com/t/cant-load-environment-variables-from-env-file/64059/4 "2021-06-09T02:09:36Z")

</div>

@dan.woda Thank you for your help

---

<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:** [June 24, 2021, 2:10am UTC](https://community.auth0.com/t/cant-load-environment-variables-from-env-file/64059/5 "2021-06-24T02:10:14Z")

</div>

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