Newbie question - how to resolve 'wrong status line' error

Hi everyone

I'm learning Ruby on Rails and wanted to perform oAuth as follows for a third party API. But I get an error as follows:

wrong status line: "<!DOCTYPE HTML PUBLIC \"-//IETF//DTD HTML 2.0//EN \">"

//Code snippet require 'net/https' require 'uri'

class UsersController < ApplicationController

  def auth        @client_id = params[:client_id]        @auth_url = "https://url/oauth/authorize? client_id=#{@client_id}"        url = URI.parse(@auth_url )        req =        res = Net::HTTP.start(, url.port) {|http| http.request(req)}

  @output = res.body   render :text => @output.inspect



Any help to proceed is much appreciated.

Looks like you’ve hit this issue:

Adding the use_ssl option, as that example does, should sort things out.

BTW, you may want to look into using one of the existing OAuth gems - there aren’t many good reasons to be re-inventing this particular wheel.

–Matt Jones