Jonathan Bennett

Twitter v2 API on Rails

I recently setup a new Twitter app to test out some ideas and ran into so fun roadblocks setting up OAuth. Here are a few notes so that you can hopefully come out on the other side with a little extra hair.

  1. Make sure you’re not using a developer environment app if you are looking to use OAuth
  2. Make sure you are not using localhost for your callback url. 127.0.0.1 does work.
  3. Make sure you pick “Native App” for the type of app. The web app option doesn’t let you use refresh tokens

If you are using Ruby on Rails the omniauth and omniauth-twitter2 gems work great for getting the initial access token.