fayland/perl-www-contact — pull request #9 by throughnothing (2012-06-05 16:59:08+00:00)
Title: Google OAuth2 Support

I'm not sure if this is really the best way, but it seemed the quickest way with the least code duplication (using GoogleContactsAPI as the base).

It basically overrides the `AuthSub` with something that can accept a google OAuth `access_token` as the password, and use that appropriately. It also returns `auth_params` that match up with what google will want for OAuth authentication.

Since google has begun sending 'suspicious sign in' emails, and also randomly preventing the password-authed logins from working (meaning that `GoogleContactsAPI` will randomly fail currently), I think using OAuth will be more and more necessary for people using WWW::Contact. Maybe eventually (or sooner) the current one should be deprecated.

http://techie-buzz.com/online-security/gmail-suspicious-sign-in-prevented.html

This doesn't do the OAuth for you, you still need to have some external method of verifying the user via google's OAuth, and retrieving an access token to pass to `WWW::Contact::GoogleContactsAPIOAuth2`. This can be done pretty simply with `Net::OAuth2::Client`, and I've made a working example here:

https://gist.github.com/2876064

I'd love some feedback or thoughts if you can think of a better way to accomplish this for now. Thanks.