0

basically my last attempt was im getting this error:

[:error, "bad URI(is not URI?): ://localhost:80/auth/twitter/auth/twitter"] 

when i browse to

http://127.0.0.1/auth/twitter

this is my goliath server

class Application < Goliath::API
  use(Rack::Session::Cookie
  use OmniAuth::Strategies::Developer
  use OmniAuth::Builder do
      provider :twitter, '..', '..'
      provider :facebook, '..', '..'
      provider :developer
  end
end

interestingly /auth/developer has no issues - but twitter or facebook has.

Any ideas?

David
  • 4,235
  • 12
  • 44
  • 52

1 Answers1

1

This a little bug from env variable that is missing some information for Rack::Request class construct the properly path.

The fix is very simple:

require 'omniauth'
require 'omniauth-twitter'
...
require 'goliath'

class Test < Goliath::API
  use Rack::Session::Cookie

  use Rack::Config do |env|
    env['rack.url_scheme'] ||= 'http'
    env['SCRIPT_NAME'] = nil
  end

  use OmniAuth::Strategies::Developer

  use OmniAuth::Builder do
      provider :twitter, '..', '..'
      provider :facebook, '..', '..'
      provider :developer
  end  

  def response env
    [200, {}, '']
  end
end

Just include the Rack::Config middleware with the properly parameters, like the example above.

Thiago Lewin
  • 2,810
  • 14
  • 18