NAME
RT::Authen::OAuth2::Google - Handler for Google OAuth2 logins
Example Metadata
Google returns something like this:
"id"
:
"123456789012345678901"
,
"email"
:
"alice@wonderland.com"
,
"verified_email"
: true,
"name"
:
"Alice Smith"
,
"given_name"
:
"Alice"
,
"family_name"
:
"Smith"
,
"locale"
:
"en"
,
"hd"
:
"wonderland.com"
Configuring Google
Set up a Google Developer's console associated with your organization's Google account. See https://console.developers.google.com
Create a project. Under Credentials, create an OAuth Client ID, and select Web Application. Enter your Authorized Redirect URI in this form:
The path /NoAuth/OAuthRedirect
must be exactly as listed here, but you should change your protocol and domain to match your configuration.
Make a note of the Client ID and Client secret listed on this page. You will need to put these in your RT_SiteConfig.pm - documentation is in the etc/OAuth_Config.pm file in this module.
Click Create. Note if you edit the URI later, you may need to click Save twice. The Google user interface is a bit finicky.
Metadata()
Takes one scalar string arg, containing the decoded response from the protected resource server. Returns a hash containing key/value pairs of user profile metadata items. Google returns JSON.