1
votes

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

app.js

1
You need to provide more info, code snippets and actual application logs. Giving a link to see it does not work isn't helping us much. I too stumble upon a lot of websites that don't work but i can't tell why. What we need is the code where you are calling/configuring the authentication. Also note that posting links like the one you did is discouraged since in a month the link may be dead and people coming to this question will be left clueless about what we were talking.Mike
A symptom seems to be the fact that when you press login the domain changes to https://undefined/authorize?redirect_uri= (see the undefined). What causes that though I can't say without more info of your code.Mike
Here is a snippet of the redirect code ** ` <Auth0Provider domain={domain} clientId={clientId} redirectUri={window.location.origin} > <App /> </Auth0Provider>`**blossom-babs

1 Answers

0
votes

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.