Skip to content

Commit

Permalink
Fix facebook access_token use #37
Browse files Browse the repository at this point in the history
  • Loading branch information
tc33 committed Apr 24, 2017
1 parent edb9646 commit a2fe999
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 a2fe999

Please sign in to comment.