title: Integrate a Rails application with Google Apps
body: <p>I'm starting a new application I'd like to integrate with Google Apps.</p>
  
  <p>I'd like to have users sign in through their Google accounts, and access Google APIs for their domain (list all domain users, and allow them to login and share the same data).</p>
  
  <p>I've never done this, so I'm a bit confused what steps do I need to perform to do it, I've read some docs on the net, and I also gave a look at omniauth.</p>
  
  <p>Requirements:</p>
  
  <ul>
  <li>only login through google apps account</li>
  <li>each user must login with its own user/pwd (google account @domain.com)</li>
  <li>all users of the same domain must see the same shared data (of course the app will take care what's public and what's not).</li>
  </ul>
  
  <p>It seemed to me that all I need to have this working is:
   * integrate an OpenID client (such as omniauth)
   * when user confirms Google will redirect user to a callback on my application
   * I now have a token that I can use to query google APIs</p>
  
  <p>Am I right?
  I've also given a look through <a href="http://intridea.com/posts/easy-rails-admin-login-with-google-apps-and-omniauth" rel="nofollow">this article</a> but it seems it's not what I'm searching for, I cannot know in advance what the user domain is.</p>
  
  <p>Maybe I'm confusing gmail accounts with google apps accounts, using the latter will users be able to login with their own account or they will all share only one account for the whole domain?</p>
  
  <p>Is <code>omniauth</code> the right gem to accomplish this kind of login?</p>
  
  <p>Thanks!</p>