title: Configuring authlogic-oauth with google
body: <p>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 <a href="http://github.com/jrallison/authlogic_oauth" rel="nofollow noreferrer">authlogic-oauth</a> and having some issues.</p>
  
  <p>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:</p>
  
  <pre><code>@user_session.save do |result|  
    if result  
      flash[:notice] = "Login successful!"  
      redirect_back_or_default account_url  
    else  
      render :action =&gt; :new  
    end  
  end  
  </code></pre>
  
  <p>Secondly, I'm trying to set up step 5, the actual Google oauth data step:</p>
  
  <pre><code>class UserSession &lt; Authlogic::Session::Base  
    def self.oauth_consumer  
      OAuth::Consumer.new("*TOKEN*", "*SECRET*",  
      { :site=&gt;"**http://google.com**",  
        :authorize_url =&gt; "*http://google.com/xxx*" })  
    end  
  end  
  </code></pre>
  
  <p>I'm not entirely sure where I find the info I need to fill this in. I've been reading <a href="https://developers.google.com/identity/protocols/OAuth_ref" rel="nofollow noreferrer">https://developers.google.com/identity/protocols/OAuth_ref</a>, but I'm just not sure where I get everything and what the plugin handles for itself.</p>
  
  <p>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?</p>