Mojolicious::Plugin::OAuth2 and Mojolicious::Plugin::Web::Auth::OAuth2 are different modules.
-Dan On Tue, Apr 16, 2019 at 12:10 PM ivo welch <[email protected]> wrote: > > Yes. I thought it was used automatically. The error message suggests > that OAuth2 is the source of the problem. > > > On Tue, Apr 16, 2019, 7:03 AM Jan Henning Thorsen <[email protected]> > wrote: > >> Have you tried https://metacpan.org/pod/Mojolicious::Plugin::OAuth2 ? >> >> >> On Tuesday, April 16, 2019 at 7:48:41 AM UTC+7, [email protected] wrote: >>> >>> >>> dear M experts. I am again struggling with the OAuth module. this is >>> perhaps because I installed a new ubuntu 18.04.2 machine, and then updated >>> Mojolicious to the current version. >>> >>> first, for anyone else struggling, Mojolicious::Plugin::Web::Auth >>> depends on Net::SSLeay, which fails installing. I believe I fixed this >>> by installing `apt install libssl-dev libz-dev`. I know this is not >>> M's fault, but I would suggest that the Auth author stop the install with a >>> good instructive error message when these two libraries are not detected. >>> grrr.... >>> >>> >>> second, my M code is still the same as before, but now it is dying with >>> a non-informative error message at the point where I had hoped to get my >>> Google authentication callback: >>> >>> *Can't locate object method "headers" via package "1" (perhaps you >>> forgot to load "1"?) at >>> /usr/local/share/perl/5.26.1/Mojolicious/Plugin/Web/Auth/OAuth2.pm line >>> 122.* >>> >>> I believe the callback I am getting from google is: >>> >>> *http://auth.syllabus.space/auth/google/callback?state=hashcode&code=hashcode=email+https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fuserinfo.email+openid&authuser=0&hd=g.ucla.edu&session_state=hashcodes&prompt=none >>> <http://auth.syllabus.space/auth/google/callback?state=hashcode&code=hashcode=email+https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fuserinfo.email+openid&authuser=0&hd=g.ucla.edu&session_state=hashcodes&prompt=none>* >>> >>> I am guessing that google encodes the email address in one of the hash >>> codes (which I have blanked here). >>> >>> my relevant (I think) code excerpt that should be called is >>> >>> package SylSpace::Controller::AuthAuthenticator; >>> use Mojolicious::Lite; >>> >>> sub google { >>> my ( $self, $access_token, $userinfo ) = @_; >>> my $name = $userinfo->{displayName} || $userinfo->{name}; >>> my $email= $userinfo->{email}; >>> >>> (defined($email)) or die "no good email."; >>> >>> return logandreturn( $self, $email, $name, 'google' ); >>> } >>> >>> looking at the code, the error comes from >>> >>> (my $res = $tx->result->is_success ) or do { >>> return $callback->{on_error}->( $tx->res->body ); >>> }; >>> >>> my $dat = $self->_response_to_hash($res); >>> >>> ... >>> >>> my $exts = $types->detect( $res->headers->content_type ); >>> >>> could someone please help me? what could have gone wrong here? >>> >>> >>> -- >> You received this message because you are subscribed to the Google Groups >> "Mojolicious" group. >> To unsubscribe from this group and stop receiving emails from it, send an >> email to [email protected]. >> To post to this group, send email to [email protected]. >> Visit this group at https://groups.google.com/group/mojolicious. >> For more options, visit https://groups.google.com/d/optout. >> > -- > You received this message because you are subscribed to the Google Groups > "Mojolicious" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > To post to this group, send email to [email protected]. > Visit this group at https://groups.google.com/group/mojolicious. > For more options, visit https://groups.google.com/d/optout. > -- You received this message because you are subscribed to the Google Groups "Mojolicious" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at https://groups.google.com/group/mojolicious. For more options, visit https://groups.google.com/d/optout.
