Twitter API + OAuth - 401 error developing locally using reverse SSH tunnel
- by oliland
I'm developing a django application which lets users connect their Twitter account.
As I'm developing locally, I have set up a reverse SSH tunnel so that the Twitter API has a valid callback url (myserver.net):
ssh -nNTR :6969:localhost:8000 myserver.net
On successful authentication, Twitter passes back its OAuth access tokens to myserver.net, which in turn attempts to access Twitter's API, which returns a 401 error.
I assume that because the callback is different to the address which is accessing the API (myserver.net / localhost), Twitter denies me access. I have tried this:
export http_proxy="http://myserver.net:3128"
Where myserver.net:3128 is running a Squid Proxy server to tunnel Twitter's API requests from my development machine so they appear to be coming from myserver, but receive the same 401 error.
When I deploy to a server with a proper hostname / static IP address it works fine. What else do I need to do?