PHPFixing
  • Privacy Policy
  • TOS
  • Ask Question
  • Contact Us
  • Home
  • PHP
  • Programming
  • SQL Injection
  • Web3.0

Saturday, February 26, 2022

[FIXED] unable post to facebook user's wall by laravel

 February 26, 2022     facebook-graph-api, facebook-php-sdk, laravel     No comments   

Issue

I'm using FaceBook SDk with laraveland try to post to user's in test roles list and I have his access_token and this token has Scopes email, manage_pages, pages_show_list, publish_pages, publish_to_groups, public_profile

but every time I try to post I got that message

(#200) If posting to a group, requires app being installed in the group, and \ either publish_to_groups permission with user token, or both manage_pages \ and publish_pages permission with page token; If posting to a page, \ requires both manage_pages and publish_pages as an admin with \ sufficient administrative permission

my controller code is

protected $fpApi;

public function __construct(FaceBook $facebook)
{
    $this->middleware(function($request,$next) use($facebook){
        $facebook->setDefaultAccessToken('WucllFJglb ..... Token from db');
        $this->fpApi = $facebook;
        return $next($request);
    });
}




public function retrieveUserProfile(){

    try{
        $attempt = $this->fpApi->post('/me/feed',['message'=>'try post a post'])->getGraphNode()->asArray();
        if($attempt['id']){ dd('done');}
    }catch(\FacebookSDKException $e)
    {
        dd($e);
    }

}

Solution

Posting to the user wall is not possible anymore. The neccessary permission (publish_actions) is deprecated.

Changelog: https://developers.facebook.com/docs/graph-api/changelog/breaking-changes/#4-24-2018



Answered By - andyrandy
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg
Newer Post Older Post Home

0 Comments:

Post a Comment

Note: Only a member of this blog may post a comment.

Total Pageviews

Featured Post

Why Learn PHP Programming

Why Learn PHP Programming A widely-used open source scripting language PHP is one of the most popular programming languages in the world. It...

Subscribe To

Posts
Atom
Posts
Comments
Atom
Comments

Copyright © PHPFixing