How to login into Drupal using Google Apps username and password? We are looking for a way using which users can login into Drupal site using their Google Apps account user name and password. We use 'Google Apps for Education' and we do not want maintain separate username and password for our Drupal site.

We would also like to limit access to certain users having Google Apps accounts. Something like filtering or pre-approved account list. And, users' account should be created automatically when they login for the first time, and they should not need to fill any additional account information in Drupal, it should be directly pulled from Google Apps account.

Is there any module for Drupal 7 that provides this functionality? I have already tried OAuth, Loginza.ru, OpenID etc. like approaches and these are not what we are looking for.

If there is no such module, how shall I proceed with writing a custom module for the same?
To integrate your Drupal 7 site with Google Apps, you need to:


Enable the OpenID module on your drupal site
Enable the Federated Login Service using your Google Apps control panel at http://www.google.com/a/cpanel/yourdomain.com/SetupIdp
Add an X-XRDS-Location header at yourdomain.com/openid  For example, if yourdomain.com is a PHP site, upload this as /openid/index.php

&lt;?php
header('X-XRDS-Location: https://www.google.com/accounts/o8/site-xrds?ns=2&amp;hd=yourdomain.com');
?&gt;

Go to your drupal site's login page. You'll see a new 'login with open id' link. Click it. Enter: https://google.com/accounts/o8/site-xrds?hd=yourdomain.com and click submit
The first time you do this, you'll be asked if you want to allow your site to authenticate. Click yes.
Subsequently, if you try to login using the above URL and you are logged in to Google Apps, you'll be logged in directly.