Sunday 3 May 2015

Heroku Toolbelt - login always successful

This drove me crazy for few months as I have a few different Heroku accounts that I used. Even though I had ran heroku auth:logout and had been shown the authentication credentials cleared feedback I was able to run heroku login and without entering anything was always showing the authentication successful message.

I had originally thought this was related to the Heroku accounts plugin I’d tried (but didn’t like) and so I’d followed the instructions of all possibly related advice to fix my issue. I’d cleared ~/.netrc and ~/.gitconfig for all Heroku related info, I’d removed the accounts plugin and I had even nuked the Heroku toolbelt install and re-installed it — but none of these things fixed it.

Then I read this piece of gold on SO and it mentioned to check for an environmental variable HEROKU_API_KEY. This was the source of my problem. I’d it added when I was doing some work a few months back (about the same time I’d installed the accounts plugin) and totally forgot to remove it. I removed the env var and now all is well.

Two lessons learned.

  1. Don’t leave API keys hanging around in your environment. It’s sloppy and risky.
  2. Even though you think you’ve learned correlation != causation, there are always new ways for you to be reminded of it.