Skip to content

Commit

Permalink
Merge pull request #38 from tc33/master
Browse files Browse the repository at this point in the history
Fix facebook access_token use #37
  • Loading branch information
claudiosanches authored Apr 24, 2017
2 parents edb9646 + a2fe999 commit d1e4516
Showing 1 changed file with 3 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,8 @@ protected function get_access_token( $settings ) {
if ( is_wp_error( $access_token ) || ( isset( $access_token['response']['code'] ) && 200 != $access_token['response']['code'] ) ) {
return '';
} else {
return sanitize_text_field( $access_token['body'] );
$access_token = json_decode( $access_token['body'], true );
return sanitize_text_field( $access_token['access_token'] );
}
}

Expand All @@ -73,7 +74,7 @@ public function get_total( $settings, $cache ) {
if ( $this->is_available( $settings ) ) {
$access_token = $this->get_access_token( $settings );
$url = sprintf(
'%s%s?fields=fan_count&%s',
'%s%s?fields=fan_count&access_token=%s',
$this->api_url . '/v2.7/',
sanitize_text_field( $settings['facebook_id'] ),
$access_token
Expand Down

0 comments on commit d1e4516

Please sign in to comment.