I made quick, dirty hack of OpenID module to add Google Federated Login. In current state, user can use https://www.google.com/accounts/o8/id as OpenID URL, but Google does not provide any username or e-mail to use for user account creation. Several parameters in OpenID request are needed to get e-mail address.

 $request['openid.ns.ext1'] = "http://openid.net/srv/ax/1.0";
 $request['openid.ext1.mode'] = 'fetch_request';
 $request['openid.ext1.type.email'] = 'http://schema.openid.net/contact/email';
 $request['openid.ext1.required'] = 'email';

Then username is derived from e-mail address.

if ($response['openid.ext1.value.email'] != '' and $response['openid.op_endpoint'] == 'https://www.google.com/accounts/o8/ud') {
  $response['openid.sreg.email'] = $response['openid.ext1.value.email'];
  $response['openid.sreg.nickname'] = substr($response['openid.ext1.value.email'], 0, strpos($response['openid.ext1.value.email'], '@'));
}

And I also added possibility to use Google account e-mail as OpenID URL (AFAIK Google is the only provider to use this, but in future, some others may tend to it, so that code should definitely be changed to something better)

if(strpos($claimed_id, '@') > 1) {
  $xrds_url = 'https://www.google.com/accounts/o8/id';
}
Files: 
CommentFileSizeAuthor
#19 339600-19_google_openid_6.patch2.25 KBalex_b
FAILED: [[SimpleTest]]: [MySQL] Unable to apply patch 339600-19_google_openid_6.patch. This may be a -p0 (old style) patch, which is no longer supported by the testbots. View
#5 glogin.zip6.05 KBetaroza
openidgoogle.patch1.66 KBChristof
FAILED: [[SimpleTest]]: [MySQL] Unable to apply patch openidgoogle.patch. Unable to apply patch. See the log in the details link for more information. View

Comments

Christof’s picture

Status: Active » Needs review
deshilachado’s picture

Version: 6.6 » 6.8

Would be nice if someone could review and accept this patch, because currently GMail accounts cannot be used as OpenID (or at least I could not figure out how to use it - just getting "Sorry, that is not a valid OpenID." error message).

Dries’s picture

Version: 6.8 » 7.x-dev

I was actually hopeful that Google would "fix" their OpenID implementation. Let's sit back and wait a couple more weeks before we include this in Drupal 7.

Status: Needs review » Needs work

The last submitted patch failed testing.

etaroza’s picture

FileSize
6.05 KB

For me the patch wasn't enough, so I created a module based on the openid module (with some copy-paste as well). For personal purposes I also removed the openid login links with (you may want to do the same if you only want Google):

if($form_id == 'user_login' || $form_id == 'user_login_block') {
    unset($form['openid_links']);
    unset($form['openid_identifier']);
}

In case people find it useful, I will be more than happy to create a separate project for this module. For now I simply attach it. (See README.txt for some notes).

Dave Reid’s picture

Issue tags: +glogin, +google login
jasperwiet’s picture

Can I make this glogin module also work under drupal 5.x? (I have no programming skills unfortunately)
Thanks everyone for the efforts by the way!

deshilachado’s picture

the google federated login is some form of "google special" openID
before drupal 6 openID support was a module which you can find here:
http://drupal.org/project/openid
since D6 this module was integrated into drupal core.
so i think for D5 support you have better chances on the project page
(if you decide to file an issue there you could link to this issue here;
see below for instructions how to link to an issue number)

nikemen’s picture

Can I do that on D6?

moshe weitzman’s picture

Has google "fixed" their openid?

Heine’s picture

We fixed our OpenID implementation to deal with OP Identifiers.

#216101: OpenID fails to auto-register account: Username invalid, email required handles situations where OpenID providers do not pass a name or emailaddress.

Whatever we do, I'd like to avoid any special coding for particular OpenID providers.

Vacilando’s picture

Subscribing to this thread.

Btw, Google is recently trying to make the public used to the idea of federated login / hybrid onboarding. This article today made me search, yet again, for a way how to register / authenticate users in Drupal 6 using Google Account.

mikl’s picture

It seems that Google has not "fixed" their OpenID implementation, and I consider it highly unlikely that they will make any changes of the sort needed to make it work with the current Drupal OpenID module, since that would likely break compatibility with the current implementation.

So either we should go out and say we do not support authentication via Google's Federated Login or apply a patch like the aforementioned to fix the issue.

Heine’s picture

Status: Needs work » Closed (duplicate)

As we modified our OpenID implementation to support OP Identifiers, and #216101: OpenID fails to auto-register account: Username invalid, email required deals with the remaining issue, marking this duplicate.

Anonym’s picture

Status: Closed (duplicate) » Needs review

openidgoogle.patch queued for re-testing.

Damien Tournoud’s picture

Status: Needs review » Closed (won't fix)

Nothing is required here anymore.

LenInkster’s picture

Status: Closed (won't fix) » Needs review
Issue tags: -glogin, -google login

openidgoogle.patch queued for re-testing.

Status: Needs review » Needs work
Issue tags: +glogin, +google login

The last submitted patch, openidgoogle.patch, failed testing.

alex_b’s picture

Version: 7.x-dev » 6.x-dev
Status: Needs work » Needs review
FileSize
2.25 KB
FAILED: [[SimpleTest]]: [MySQL] Unable to apply patch 339600-19_google_openid_6.patch. This may be a -p0 (old style) patch, which is no longer supported by the testbots. View

#11 Heine: I hear you. But adding a fallback maybe just enough - see attached patch. I whipped that up in 6 because I need it to work for a project at hand. I can roll a D7 patch if we like this approach.

andriy_gerasika’s picture

see a patch at http://drupal.org/node/946998#comment-3628378 -- it introduces attribute exchange to Drupal 6 core OpenID module. Code is backported from Drupal 7.

Status: Needs review » Needs work

The last submitted patch, 339600-19_google_openid_6.patch, failed testing.

c960657’s picture

Status: Needs work » Closed (duplicate)

Supporting AX is covered by #634562: OpenID AX support. This issue has been fixed in D7 and should be backported.

The Google OpenID Provider does not provide a nickname field, so the user has to choose one himself. In [##216101: OpenID fails to auto-register account: Username invalid, email required we decided against trying to make up one based on the users email. Instead the information text is updated to reflect this. This has been fixed in both D7 and D6.

euractiv’s picture

Status: Closed (duplicate) » Needs review
Issue tags: -glogin, -google login

#19: 339600-19_google_openid_6.patch queued for re-testing.

Status: Needs review » Needs work

The last submitted patch, 339600-19_google_openid_6.patch, failed testing.

Anonym’s picture

Status: Needs work » Needs review
mgifford’s picture

Issue summary: View changes
Status: Needs review » Closed (won't fix)

I don't think this is getting into Core. Certainly not D6 or D7 Core.