Question

My test environment for my Ruby (Sinatra + twitter_oauth) project is behind a proxy.

In the documentation, I read how to use the twitter_oauth gem with a proxy. But there the author says:

First you need to authorize the Twitter user via OAuth directly via the Twitter API (this part cannot be proxied)

But unfortunately, on this step I receive an proxy error when testing locally.

Is there any possibility to proxy this?

    client = TwitterOAuth::Client.new(
    :consumer_key => 'YOUR_APP_CONSUMER_KEY',
    :consumer_secret => 'YOURA_APP_CONSUMER_SECRET'
    )
    request_token = client.request_token(:oauth_callback => 'YOUR_CALLBACK_URL')

Thanks in advance!!

Was it helpful?

Solution

No, but OAuth can be skipped if a check for local environment is wrapped around the authentication:

def localhost
 client = "Test"
 request_token = "Me"

def webhost
 client = TwitterOAuth::Client.new(
 :consumer_key => 'YOUR_APP_CONSUMER_KEY',
 :consumer_secret => 'YOURA_APP_CONSUMER_SECRET'
 )
 request_token = client.request_token(:oauth_callback => 'YOUR_CALLBACK_URL')
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top