Pass email along.
[scpubgit/stemmaweb.git] / lib / stemmaweb / Authentication / Credential / Google.pm
index 5a7e3d8..32f22c9 100644 (file)
@@ -48,11 +48,17 @@ sub authenticate {
         Catalyst::Exception->throw("id_token not specified.");
     }
 
+    my $email = $authinfo->{email};
+    $email ||= $c->req->method eq 'GET' ? $c->req->query_params->{email} :
+    $c->req->body_params->{email};
+
     my $userinfo = $self->decode($id_token);
 
     my $sub = $userinfo->{sub};
     my $openid = $userinfo->{openid_id};
 
+    $userinfo->{email} = $email if $email;
+
     if (!$sub || !$openid) {
         Catalyst::Exception->throw(
             'Could not retrieve sub and openid from token! Is the token