rails + satelizer - twitter login

45 views Asked by At

I am using Satelizer for social logins in a rails app. There's no ruby implementation, so I made one adapted from the node version.

So, after pressing the login with twitter button, I get to my controller, and the following code produces the message: "Bad Authentication data", code: 215

What am I doing wrong?

    requestTokenUrl = 'https://api.twitter.com/oauth/request_token'
    accessTokenUrl = 'https://api.twitter.com/oauth/access_token'
    profileUrl = 'https://api.twitter.com/1.1/users/show.json?screen_name='

    requestTokenOauth = {
      consumer_key: ENV['TWITTER_KEY'],
      consumer_secret: ENV['TWITTER_SECRET'],
      callback: ENV['TWITTER_CALLBACK']
    };
    params = {'oauth' => requestTokenOauth }

    require "net/https"
    require "uri"

    uri = URI.parse requestTokenUrl
    http = Net::HTTP.new(uri.host, uri.port)

    # https stuff
    http.use_ssl = true
    http.verify_mode = OpenSSL::SSL::VERIFY_NONE

    request = Net::HTTP::Post.new(uri.request_uri)
    request.set_form_data(params)
    response = http.request(request)
    binding.pry
0

There are 0 answers