7
votes

I am trying to learn rails, and I'm working on an app that uses Google for logins and also for calendar data. I'm currently working on configuring authlogic-oauth and having some issues.

I've been following the guide for the authlogic-oauth (see link above) plugin, and I'm on steps 4 and 5. First off, I am still learning the language and I'm not sure where the code from step 4 goes in the controllers:

@user_session.save do |result|  
  if result  
    flash[:notice] = "Login successful!"  
    redirect_back_or_default account_url  
  else  
    render :action => :new  
  end  
end  

Secondly, I'm trying to set up step 5, the actual Google oauth data step:

class UserSession < Authlogic::Session::Base  
  def self.oauth_consumer  
    OAuth::Consumer.new("*TOKEN*", "*SECRET*",  
    { :site=>"**http://google.com**",  
      :authorize_url => "*http://google.com/xxx*" })  
  end  
end  

I'm not entirely sure where I find the info I need to fill this in. I've been reading https://developers.google.com/identity/protocols/OAuth_ref, but I'm just not sure where I get everything and what the plugin handles for itself.

Finally, I'm not quite sure how I retrieve the calendar info, I've just been told I could by someone on IRC. Do I do it through this plugin or do I have to use another one as well?

1

1 Answers

1
votes

How to login with Google OAuth into your Ruby on Rails application you can read at manu-j blog. There is mentioned in first paragraph how to obtain those keys. You have to register your domain with google.

But this just logging into your app, not into your google acount. It sounds you think after logging with OAuth you can access all your google applications and google saved datas (like calendar). The OAuth service is similar to OpenID. Both are only services to autenticate user in your app (instead of registering into your app).

If you want to use some Google calendar data in your app, you can start with Googlecalendar gem, rails plugin and example.