Revision 659

Date:
2017/08/08 16:46:56
Author:
ahitrov
Revision Log:
Facebook oAuth update

Files:

Legend:

 
Added
 
Removed
 
Modified
  • utf8/plugins/session/lib/session/AUTH/FaceBook.pm

     
    108 108 warn "access_token request failed: ".$res->status_line;
    109 109 return undef;
    110 110 }
    111 my %res = eval { URI->new("?".$res->content)->query_form };
    112 warn Dumper(\%res) if $DEBUG;
    113 unless ($access_token = $res{access_token}) {
    111 my $token_response = eval { JSON::XS->new->utf8->decode($res->content) };
    112 warn Dumper($token_response) if $DEBUG;
    113 if ( ref $token_response eq 'HASH' && exists $token_response->{access_token} && $token_response->{access_token} ) {
    114 $access_token = $token_response->{access_token};
    115 } else {
    114 116 warn "No access token in response: ".$res->content;
    115 117 return undef;
    116 118 }
    117 119 $local_session->set( facebook_access_token => $access_token );
    118 if( my $expires = $res{expires} ) {
    120 if( my $expires = $token_response->{expires_in} ) {
    119 121 $local_session->set( facebook_expires => time + $expires );
    120 } else {
    121 #$local_session->set( facebook_expires => time + 3600*24 );
    122 122 }
    123 123 warn "FB: requested access token" if $DEBUG;
    124 124 } else {