Auth0 Home Blog Docs

Callback URL Not Working In Heroku

heroku
callback-urls
callbacks
deploy

#1

I have a Node.js react application where I have manually installed and configured Auth0. Everything works wonderfully locally. After deploying the app to heroku the app runs, but users cannot successfully login. I am given the error “Cannot GET /callback” after attempting to login through the hosted lock. I have searched and searched but cannot find any advice on this. I do have both my local callback and my heroku callback whitelisted in Auth0 settings (“http://localhost:3000/callback” and “http://herokuAppURL.com/callback”). I have experimented using both of these in my auth0-variables.js file callback variable, then redeploying, and no luck there either. Any advice on how to get the callback to work? The app is pretty straight forward and I used the Auth0 node package pretty much straight out of the box…just entered my credentials.


#2

Based on the information you provided the issue is with the deployment to Heroku and as such is difficult to troubleshoot it in isolation because it’s likely very coupled to your case. The reason to point to a deployment issue is the fact that it works locally and that, by default, the authentication response is communicated with a simple HTTP redirect so what the hosted login page does is just navigating to the redirect URI that you requested (in this case it should be the Heroku one).

If you get an error like Cannot GET /callback it suggests that the application does not implement that path. However, the information provided is insufficient to provide definitive answers (unless someone already experienced the exact same issue and I have not). I would recommend trying to find any possible differences between what you’re doing locally versus what’s being deployed.


#3

I am facing a similar issue, did you find any solution to this? It works locally, the only thing I replaced was the Heroku application URI.


#4

Hi there I’m sorry to reply so late. What ended up working for me was to push my entire folder of files to heroku. I was attempting to push the “build” folder that gets created when ejecting a create-react-app. That has worked for me in the past, but not this time. So what worked was to push the entire root folder to heroku. I know this is extraneous and probably not the correct fix, however it worked for me and after many attempts and code review it was the only thing I could do.


#5

I was having the same issue and resolved it by adding http://localhost:3000 to Allowed Web Origins.


#6