Invalid authorization code- Rails

At this point I’m pretty lost- as far as I can tell, I’m sending a properly formatted POST request to https://api.twitch.tv/kraken/oauth2/token. The API says that the auth code is wrong, but inspecting the request I send, the code is exactly identical to the one I receive immediately beforehand. Any tips on what might be the issue here?