Invalid authorization code- Rails

Hmm, the only reason you should get that error (assuming the login flow is all correct) is due to trying to re-use an auth token. What is your client_id, and what user were you trying to login with?