0

Hi I know this question have been asked before but the answers there isn't working for me.

I still get the, when redirecting back to my site.

/auth/failure?message=invalid_response

I have ruby 1.9.2p180 (2011-02-18 revision 30909) [x86_64-darwin10.6.0] installed, using rails 3.0.7 and the required gems installed. I read on another thread that you should have pure_json added to the gemfile to make it work. But that didn't help me either.

I'm clueless... Thanks in advance

    authenticationscontroller
      def index
    @authentications = current_user.authentications if current_user
  end
  def create
      #render :text => request.env["omniauth.auth"].to_yaml
      auth = request.env["omniauth.auth"]
        current_user.authentications.find_or_create_by_provider_and_uid(auth['provider'], auth['uid'])
        flash[:notice] = "Authentication successful."
        redirect_to authentications_url
      end
Philip
  • 6,827
  • 13
  • 75
  • 104

1 Answers1

1

I was able to get this to work by specifying the following in my Gemfile

gem 'omniauth', '0.2.0'

Version 0.2.6 wouldn't work for me. I also updated by .rvmrc to rvm use 1.9.2@rails3. Oh, also make sure you're logged in - do note that in your code above you are assuming that current_user exists. See Ryan's Railscast part two for allowing user creation via Omniauth.

I've got a demo working here, but do note I'm doing authentication from scratch rather than using Devise.

Michael De Silva
  • 3,808
  • 1
  • 20
  • 24