localhost Not a Valid Callback URL

Apparently, you can’t have http://localhost:3000/callback as a callback url for some API’s. Fitbit’s API doesn’t allow it for example. To get around this without having to purchase a domain and/or deploying you can use ngrok.

With ngrok you can expose your localhost to a public url. You can get a free account, download, install , and expose it to you $PATH if necessary. To connect ngrok to you account run this:

./ngrok authtoken <YOUR_AUTH_TOKEN>

You then run the ngrok server in one console like so:

./ngrok http 3000

The response should have the public url that your localhost will be exposed to. You can use that as the callback url. In another console run the server of your app on the same port. The catch is that a free account will give you a random url each time you run the ngrok server so you have to always change the callback url registered to the app on the api site EACH time you run it. Paid plans can let you reserve a url so that you don’t have to do that but you can miss me with that.