request_token = consumer.get_request_token(oauth_callback: CALLBACK_URL) req_url = request_token.authorize_url(oauth_callback: CALLBACK_URL) puts <<EOS Go to the following URL and authorize your account on a browser: #{req_url}
Copy the redirected url from the browser and paste it: EOS
input = STDIN.gets redirected_url = input.chomp rurl = URI.parse(redirected_url) params = {}.tap do|h| URI.decode_www_form(rurl.query).each do|entry| h[entry[0].to_sym] = entry[1] end end