Is there anything to open source here to avoid everyone having to write the same server crap code?
Oauth.io is a hosted authentication service with support for ~75 OAuth providers. Omniauth is a Rake middleware for handling authentication flows, and supports many providers.
OAuth is horrible. There, fixed it for him ;)