Auth0 .env values and Netlify

Hi, I’ve recently deployed my site via Netlify and it has stopped the redirect to my Auth0 domain from working. When I was running the site locally (on localhost:3000) when I click Logon I was redirected correctly as follows: etc. etc.
Now my site is deployed via Netlify when I click Logon I am redirected incorrectly as follows: https://undefined/authorize? etc. etc.

I believe this is because of the way I have configured Auth0 to work on my site where I’m storing my Domain and Client Key in a .env file as follows:

As .env files are not synced up to GitHub where Netlify deploys from it is not picking up these settings. I have tried to fix this by manually adding the Domain and Client Key to Netlify as environmental variables as follows:

However, this hasn’t worked. Any ideas how best to fix this?

It looks like these variables still aren’t making it into your netlify deployment, hence the undefined.

You don’t really have to worry about keeping client ID and domain secret, as they will be sent in any request to authenticate, regardless if the user is logged in or anonymous. Anyone that navigates to your web page can access them, more or less. (client secret should never be shared, on the other hand). If you are worried about having domain and client id publicly available you could make the repo private.

I don’t have any experience with netlify secrets, so I won’t be much help debugging that.

1 Like

Thanks Dan - this approach works nicely!

1 Like

Great. Thanks for the update!

1 Like

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