Auth0 Home Blog Docs

App #2 Keeps Trying to Connect App #1


#1

I built a web app using Auth0 as well as Node, React, Express, MongoDB.
Then I wanted to create a new web app with the same basic bones as the first app, so I duplicated the original files and made the necessary changes. This worked fine except that: When I press the login button on the new app it still takes me to the login for the old app.

I’ve setup a new application within the Auth0 control panel and I’ve copied the new Client ID to auth0-variables.js file. I’ve also updated environment variables with Heroku (where I’m testing authentication at the moment).

When I run:
heroku config:get AUTH0_CLIENT_ID

I get the Client ID that matches the new project, but when I open the web app and click Login, I’m still taken to a sign in page with the title of the old app, and then redirected to the old app’s callback.

It seems my app is still getting a value somewhere that tells it to connect to the old app, but I’ve combed through all the files again and again and I just can’t seem to find where it’s finding any reference at all to the old app.

I feel like I’m missing something obvious but I’ve been beating my head against the wall for several days and haven’t come up with anything.

Any idea what I’m missing?


#2

I’ve succeeded in getting the localhost version of the site to log in to the correct Auth0 application, but when the project is deployed to Heroku it still tries to log into the old app.

Another problem that may or may not be related:
After logging into the localhost version, when I make a call to the /userinfo route via the getProfile function, I get a 401 unauthorized error.
I’m assuming perhaps the old ‘client secret’ is still in place somewhere, but I’m still not sure where.


#3

The /userinfo route usually works now, but occasionally stops working. If I ever logout of the test application, for example, everything falls apart. Program still consistently connects to the wrong app on Heroku.

When I click the login button (on the local version), the Auth0 login page opens and I appear to be able to sign in fine. However it seems no access token is being stored. Not sure if these are unrelated errors or all stemming from the same underlying problem.


#4

Can you send me a DM with your tenants and we can investigate?


#5

In addition it would be good to fully analyse your code and make sure you’re not missing something - especially since localhost works but server does not.


#6

Jeremy, thanks so much for getting back to me! I actually had a break through yesterday and I think I’ve now got the problem solved. Seems to have been an issue with the build script (apparently why it worked fine locally but not in the production version).

Very relieved to have it working again!