I have created a react app using Auth0 and everything works fine locally. But when I deploy to heroku, Auth0 no longer works.
Note:I have added the deployed link to the following in the application - Allowed Callback URLs, Allowed Logout URLs, Allowed web origins.
Still it doesn't work: https://seams.netlify.app/
This is the error I get:https://undefined/authorize?redirect_uri=
This is where the redirect is coming from
Both your clientId
and domain
hold the value of the environment variables REACT_APP_AUTH0_CLIENT_ID
and REACT_APP_AUTHO_DOMAIN
. These need to be configured in the environment where you're deploying. In your localhost , you do that in .env
file mostly. In your deployment environment, a UI generally exists that can help you do the same. So you can search for how to do the same in netlify.
Here is the documentation that will help you - https://docs.netlify.com/configure-builds/environment-variables/?_ga=2.167654334.1252444955.1614077370-1741414160.1614077370
The below step has worked in the past seamlessly for me :-
In Site settings > Build & deploy > Environment > Environment variables. Variable values set under site settings will override the team-level settings.