Code Monkey home page Code Monkey logo

laravelfacebooksdk's People

Contributors

arubacao avatar irazasyed avatar joshbrown avatar melhakim avatar nkwaerd avatar palpalani avatar piotros avatar sammyk avatar souflam avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

laravelfacebooksdk's Issues

Token still sometimes null from getTokenFromRedirect()

Sorry. Please don't get a court order or something against me asking so many questions :)

I've basically exactly copied your example code for logging in a user by Facebook. Here it is:

    public function facebooklogin()
    {
        try
        {
            $token = Facebook::getTokenFromRedirect();

            if(!$token)
            {
                ob_start();
                var_dump(Input::all());
                $params = ob_get_contents();
                ob_end_clean();
                Log::error($params);
                return Redirect::to('/error')->with('error', '<!snip!> (Error 101)');
            }
            ...

At this point it hits that redirect and we're done. The error code was just so I knew at which point the error redirect happens. The log shows the redirect URL parameters look like this:

[2015-01-17 14:20:46] production.ERROR: array(2) {
  ["code"]=>
  string(323) "AQCHTNya-xzAc9eOgs7gD1RdgsG90Tgx_WqZvpTtoag99El8d27A7FsSKyUm6QfvU8eZcuQh6PPsselYemqqQ2dXHbPlP2gJknA949-75M5b1EXVaBJ7DgWymG6JHh6r9T7-STbVceTJqQNCSVTZ0NVBsn_aYTG852aMMFZS0fPgGli98X3hgzNdod4nZpJ4lBM2XOYtUPeyIsI780zP1lMy3wcxtmEeeHQVeC4LRWUkahqoOBfiQAawRDO27slChM3NdyIUvoj4JpINCv-RW-mw5IUe3RqruohlcXi9DoL34avGxoGwc7pUcFoW-SB6v14"
  ["state"]=>
  string(32) "611e655b35c625ea319b0c482a3810d5"
}

Which presumably means the token wasn't empty. Am I missing something? Other than a clue? Or is it a bug?

Final point: this has never happened to me when testing. It's happened to some people while testing, and (in what is probably a coincidence) they were using the built in Android browser on their phones.

Update: I logged the whole URL and there's nothing else to it; just code and state. Also, I assume this is correct, but this is the relevant part of the config:

'default_scope' => ['email'],
'default_redirect_uri' => '/facebook/login',

Cannot make offline calls to FB using Laravel Queue API

Trying to fetch user's photos using Laravel Queue API

But even simple call like this throws SammyK\FacebookQueryBuilder\FacebookQueryBuilderException

Facebook::setAccessToken($user->access_token['access_token']);
$user = Facebook::object('me')->fields('id', 'name')->get();

I'm using long lived access token here.

What am I doing wrong?

Thanks for help.

Not able to use Facebook facade

Not sure if its just me or for everyone...
I am not able to use "Facebook" facade.
I added alias and provider entry in my app.php, created proper configs as per readme file.
Please help if there is a known issue or something missing in readme or its just me :(

help : Error validating verification code. Please make sure your redirect_uri is identical to the one you used in the OAuth dialog request

here's my code
route.php :
Route::get('fby', 'WelcomeController@LogWithFb');
Route::get('/facebook/login', function(SammyK\LaravelFacebookSdk\LaravelFacebookSdk $fb) {
$login_link = $fb
->getRedirectLoginHelper()
->getLoginUrl('http://localhost:8000/fby', ['email', 'user_events']);

echo '<a href="' . $login_link . '">Log in with Facebook</a>';

});

in my WelcomeController :
use SammyK\LaravelFacebookSdk\LaravelFacebookSdk;
public function LogWithFb(LaravelFacebookSdk $fb) {
// // Obtain an access token.
try {
$token = $fb->getAccessTokenFromRedirect();
} catch (Facebook\Exceptions\FacebookSDKException $e) {
dd($e->getMessage());
}
// Access token will be null if the user denied the request
// or if someone just hit this URL outside of the OAuth flow.
if (!$token) {
// Get the redirect helper
$helper = $fb->getRedirectLoginHelper();

        if (!$helper->getError()) {
            abort(403, 'Unauthorized action.');
        }

        // User denied the request
        dd(
                $helper->getError(), $helper->getErrorCode(), $helper->getErrorReason(), $helper->getErrorDescription()
        );
    }

    if (!$token->isLongLived()) {
        // OAuth 2.0 client handler
        $oauth_client = $fb->getOAuth2Client();

        // Extend the access token.
        try {
            $token = $oauth_client->getLongLivedAccessToken($token);
        } catch (Facebook\Exceptions\FacebookSDKException $e) {
            dd($e->getMessage());
        }
    }

    $fb->setDefaultAccessToken($token);

    // Save for later
    Session::put('fb_user_access_token', (string) $token);

    // Get basic info on the user from Facebook.
    try {
        $response = $fb->get('/me?fields=id,name,email');
    } catch (Facebook\Exceptions\FacebookSDKException $e) {
        dd($e->getMessage());
    }

    // Convert the response to a `Facebook/GraphNodes/GraphUser` collection
    $facebook_user = $response->getGraphUser();

    // Create the user if it does not exist or update the existing entry.
    // This will only work if you've added the SyncableGraphNodeTrait to your User model.
    $user = App\User::createOrUpdateGraphNode($facebook_user);

    // Log the user into Laravel
    Auth::login($user);

    return redirect('/')->with('message', 'Successfully logged in with Facebook');
}

i just copy paste the example into my fresh laravel 5.. am i doing something wrong with this code?

best regards,

Flow

Hi @SammyK,
Thank you for your amazing work!
If you don't mind I would ask you a couple of questions.

I read your articles on https://www.sammyk.me
I read your documentation.
I'm practicing on a personal project hosted on my localhost running with Laravel 4.2.
My Facebook app is well configured.

So I have a page "/login" which displays 3 social login buttons "1)Facebook" ; "2)Google" ; "3)Twitter"

When I click on "1)Facebook" it redirects to "/auth/facebook" and starts the login flow.

What is the purpose of the following line?

Facebook::setAccessToken($token);

Once this line is executed, I can perform FbGraph requests.
What happens if user go to another page? For example "/profile"
On this route, I need to perform a request on the FbGraph again.

For now, if I try it says:

Method Facebook\Entities\AccessToken::__toString() must return a string value"

What is the flow I'm missing from the first steps? I guess I need to store the token to the session then retrieve it from the route /profile to be able to perform requests? I tought it was the work done by setAccessToken method! Is it?

Can you please give me some directions about the flow to follow? The goal of the token is to not be asked at each request. What is the best way to store it and use it.

With best regards,

J.

token

first, Good work!

i have a question,
How do you keep the token between functions and controllers without having to call Facebook::getLoginUrl and Facebook::getTokenFromRedirect every time.

and Do you have an example project in laravel using LaravelFacebookSdk?, it would really help lost people like me.

thanks

Errors when connecting to Facebook

Hi there, great plugin!

I'm using this code on a couple of sites, and getting the same issues on both. Sometimes, but not always I'm getting:

Method Facebook\Entities\AccessToken::__toString() must return a string value

I'm also sometimes getting

Failed to connect to graph.facebook.com port 443: Connection timed out

First I'm running a function grab the token, then grabbing data about the Facebook user.

public function getToken(){
    try
    {
        $token = Facebook::getTokenFromRedirect();
        if (!$token)
        {
            return Redirect::to('/')->with('error', 'Please try again.');
        }
    }
    catch (Exception $e)
    {
        return Redirect::to('/')->with('error', 'Please try again.');
    }
    Facebook::setAccessToken($token);
}
public function getUser(){
    try
    {
        $this->facebook_user = Facebook::object('me')->fields('id', 'name','email', 'gender', 'locale', 'first_name', 'last_name')->get();
        $this->facebook_user = json_decode($this->facebook_user, true);
    }
    catch (FacebookQueryBuilderException $e)
    {
        return Redirect::to('/')->with('error', 'Please try again.');
    }
}

The first error seems to occur in the getUser function.

Any help would be great, thanks!

Facebook throws configuration error "Given URL is not allowed by the Application configuration

Hello there, first thanks for the package. I am trying to log a user in with facebook using your package but facebook keeps throwing this error.

Given URL is not allowed by the Application configuration.: One or more of the given URLs is not allowed by the App's settings. It must match the Website URL or Canvas URL, or the domain must be a subdomain of one of the App's domains.

I know what this means, and i have checked and triple checked that everything is right in my app config at facebook. All the domains and such. I think there must be something with the php sdk v4 thats preventing user login because when i tried login with the JS SDK with the same app config at facebook it worked perfect. I have done research and i can't figure this out. Any help would be greatly appreciated. Thanks.

Duplicated Values

Hello!

When I use this code:

        Facebook::setAccessToken( $page_queue->page_token );
        $page  = Facebook::object('me/feed')->get();

I get duplicated values of feed. Is this an error on the package or a something to do with the facebook sdk?

Thanks.

Facebook app doesn't connect

Hello, what is the configuration that can i use to connect ?
i'm using for my app domain ( localhost ) and for the website url http://localhost, but the problem that when i try facebook throught the following error

Given URL is not allowed by the Application configuration.: One or more of the given URLs is not allowed by the App's settings. It must match the Website URL or Canvas URL, or the domain must be a subdomain of one of the App's domains.

what do you recommend ?

Class 'Facebook\FacebookSession' not found

I recieved the following error installing different versions of the package trough composer: PHP Fatal error: Class 'Facebook\FacebookSession' not found in /sammyk\facebook-query-builder\src\Connection.php:82

I tried to install the following versions (also removed the whole vendor directory and cleared composers cache).

  • 1.1.x-dev
  • 1.1.2
  • 1.1.1
  • 1.1.0
  • 1.0.0

Except for 1.0.0 none of them worked the way they should. I'm running that until there is a better solution.

  • I saw that it's a recurring issue: #12
  • *In connection.php the use properties (for namespacing) where present.

Installing via Composer installs old version of FacebookQueryBuilder

When I add "sammyk/laravel-facebook-sdk": "dev-master" or "sammyk/laravel-facebook-sdk": "1.0.*", laravel-facebook-sdk installs 1.0.1 of FacebookQueryBuilder. This throws an error: "Call to undefined method SammyK\FacebookQueryBuilder\FQB::setRedirectHelperAlias()" since this was added in 1.0.6.

Am I missing something? Or does the version requirement need to be updated?

Thanks!

Error when extending access token

Hi,

I'm trying to use this package, and I need to get a long lived access token. However, when I call $token->extend(), I get an error:

Exception 'Facebook\FacebookSDKException' with message 'You must provide or set a default application secret.'

It seems that in AccessToken.php, in the extend method, this array is not correctly filled.

$params = [
'client_id' => Connection::$app_id,
'client_secret' => Connection::$app_secret,
'grant_type' => 'fb_exchange_token',
'fb_exchange_token' => $this->access_token,
];

When I dump $params there, 'client_id' and 'client_secret' are null, which seems to be the reason for the error.

How can I fix this?

Thanks!

How to create a new FacebookRequest?

Sammy,

I've trouble with de-authorizing users, I want them to just disconnect their accounts by a press on the button. What I could find on Facebook was that there is a FacebookRequest method that lets you do stuff like that, is there also such a method available in your package?

/* PHP SDK v4.0.0 */
/* make the API call */
$request = new FacebookRequest(
  $session,
  'DELETE',
  '/me/permissions'
);
$response = $request->execute();
$graphObject = $response->getGraphObject();
/* handle the result */

Invalid appsecret_proof provided in the API argument

I use Laravel 4.2, so I've installed LaravelFacebookSdk 1.2 branch

The first error i got was "Graph returned an error response" but after I added a try/catch I got a detailed error: string(52) "Invalid appsecret_proof provided in the API argument"

My App ID, App Secret and Access Token are good, I checked them 3 times. In my app panel settings/advanced the App Secret Proof for Server API calls option is set to No but I tryed to switch it just to see if it works but with no success.

In composer.json I have something like this: "sammyk/laravel-facebook-sdk": "~1.1" , I've followed all the stepps one by one and I got into this error and don't know what to do.

Can you help me please? Thanks

Error posting Link

friend

Firstly thank you for this great package for Laravel.

I have been reviewing the API documentation facebook and I face a serious mistake is that when I try to post a link through this package generates a FacebookQueryBuilderException me (10) error.

When I try to send only a single functioning properly post:

$status_update = array ('message' => 'Here Menssage');

But when I try to send a link debuelve me the error that you commented

$status_update = array ('link' => $ url, 'message' => 'Here Menssage');

FacebookQueryBuilderException (10).

I wonder where I am failing

$url = 'www.google.com';
Facebook::setAccessToken('Access-Token');
$status_update = array('link' => $url, 'message' => 'Here Mensagge');
$response = Facebook::object('page_id/feed')->with($status_update)->post();

Facade Problem

I'm getting the following
BindingResolutionException in compiled.php line 1067:
Unresolvable dependency resolving [Parameter #0 [ $message ]] in class Exception
When I try and use the Façade any idea what I might have done wrong

or Is there anyway to make a post

$status_update = ['link' => $url,
'message' => $message,
'picture' => $imgurl,
'name' => 'More Info',
'description' => 'Visit site to apply for this job',];
$response = \Facebook::object('1395318612227381/feed')->with($status_update)->post();

Without the facade

How to disable appsecret_proof sending?

Hi,

I'm in trouble. I would disable appsecret_proof. It's easy with "facebook/facebook-php-sdk-v4" by FacebookSession::enableAppSecretProof(false);

However, v4.1 doesn't have FacebookSession anymore. Is it possible to disable it in LaravelFacebookSdk?

Thanks,
D.

Refactor for SDK 4.1 support

A stable version of version 4.1 of the Facebook PHP SDK hasn't been released yet, but when it is, a refactor is in order.

when scope is set no callback is happening

I am having a weird problem.
when i set up the

       default_scope=['email','public_profile'];

the callback from facebook is not happening.
i can login successful but no callback
i have tried setting it up on the

$this->fb->getLoginUrl(['email','public_profile'],'http://example.com.com/callback/');

but the same issue
if i remove the scope it works with out any problem...
anybody has a clue what i am doing wrong... the code that i use is a copy and paste from the example with the exemption that i am returning a view and passing the loginurl.
thanks

Save access_token in users table?

I have a user logging in fine and saving all of their info (id, name, email, etc) to the DB, but it does not seem to be saving the access_token? Isn't it supposed to be? I am not sure why it isn't saving that portion in the DB...I can't tell if it is a bug, or something I need to configure so that it saves correctly.

Method Facebook\Entities\AccessToken::__toString() must return a string value

I've read #2 and #6 and I'm pretty sure I don't need to set an access token for the request I'm trying.

I'm trying to get the public data for a page. With $id being the page ID and $this->fbq the instantiated FQB object from the Laravel Service Provider: facebook-query-builder.

This should work for public data right? The funny thing is that it did work at first but then stopped working after I did a query to https://www.facebook.com/dialog/pagetab.

$this->fbq->object($id)->get();

Stacktrace (don't even ask about the Zend stuff 😉), I replaced the page id's.

#0 /vagrant/vendor/facebook/php-sdk-v4/src/Facebook/FacebookSession.php(85): Illuminate\Exception\Handler->handleError(4096, 'Method Facebook...', '/vagrant/vendor...', 85, Array)
#1 /vagrant/vendor/facebook/php-sdk-v4/src/Facebook/FacebookRequest.php(198): Facebook\FacebookSession->getToken()
#2 /vagrant/vendor/sammyk/facebook-query-builder/src/FacebookRequestMaker.php(26): Facebook\FacebookRequest->__construct(Object(Facebook\FacebookSession), 'GET', '/<page-id>.', Array, NULL)
#3 /vagrant/vendor/sammyk/facebook-query-builder/src/Connection.php(196): SammyK\FacebookQueryBuilder\FacebookRequestMaker->make(Object(Facebook\FacebookSession), 'GET', '/<page-id>', Array)
#4 /vagrant/vendor/sammyk/facebook-query-builder/src/Connection.php(149): SammyK\FacebookQueryBuilder\Connection->send('/<page-id>')
#5 /vagrant/vendor/sammyk/facebook-query-builder/src/FQB.php(112): SammyK\FacebookQueryBuilder\Connection->get(Object(SammyK\FacebookQueryBuilder\RootEdge))
#6 /vagrant/src/Services/Facebook/SammyFacebook.php(35): SammyK\FacebookQueryBuilder\FQB->get()
#7 /vagrant/application/controllers/AccountController.php(838): Beatswitch\Services\Facebook\SammyFacebook->getPageById('<page-id>')
#8 /vagrant/vendor/zendframework/zendframework1/library/Zend/Controller/Action.php(516): AccountController->servicesAction()
#9 /vagrant/vendor/zendframework/zendframework1/library/Zend/Controller/Dispatcher/Standard.php(308): Zend_Controller_Action->dispatch('servicesAction')
#10 /vagrant/vendor/zendframework/zendframework1/library/Zend/Controller/Front.php(954): Zend_Controller_Dispatcher_Standard->dispatch(Object(Zend_Controller_Request_Http), Object(Zend_Controller_Response_Http))
#11 /vagrant/vendor/zendframework/zendframework1/library/Zend/Application/Bootstrap/Bootstrap.php(101): Zend_Controller_Front->dispatch()
#12 /vagrant/vendor/zendframework/zendframework1/library/Zend/Application.php(366): Zend_Application_Bootstrap_Bootstrap->run()
#13 /vagrant/public/index.php(43): Zend_Application->run()
#14 {main}

Custom state parameter

is there any way that i can create a custom state param on the getLoginurl...?
what i am trying to do is pass some parameters on the oauth request endpoint and get back the state.
the state to be base64 encoded of my parameters...
i dont know if what i am saying is valid with the facebooksdk v4.
thanks.

Batch API calls

First of all, thanks for your great package. I'm starting with a new project on Laravel and I want to know is there is a way to make batch API calls with this package.

Thanks in advance!

redirect to app page not the facebook app canvas

Hello i have a problem and i would be happy if you helped me in it, i have a facebook page tab that we i click on connect i use your example to get the loggin data and redirect back to the website app , but what i want here to redirect to facebook app tab ( the canvas ) and be logged in the canvas also

can i do that ? sorry for my bad english but any help would be appreciated

Class 'Facebook\FacebookSession' not found

When I set this up I get:

PHP Fatal error:  Class 'Facebook\FacebookSession' not found in /Users/bokeh/me/projects/blacklist/code/master/vendor/sammyk/facebook-query-builder/src/Connection.php on line 82

Indeed I'm not sure where Facebook\FacebookSession is supposed to be called.. Any idea how to proceed?

Doc amendment - VerifyCsrfToken conflict for page tab/canvas

Just getting setup on a Laravel 5 project, great project, really handy!

The default setup in Laravel 5 has a default middleware to verify the csrf token, which throws an exception in page tab & canvas setup as these use post requests.

Could be worth putting in the documentation.

in App//Http/Kernel.php

protected $middleware = [
    'Clockwork\Support\Laravel\ClockworkMiddleware',
    'Illuminate\Foundation\Http\Middleware\CheckForMaintenanceMode',
    'Illuminate\Cookie\Middleware\EncryptCookies',
    'Illuminate\Cookie\Middleware\AddQueuedCookiesToResponse',
    'Illuminate\Session\Middleware\StartSession',
    'Illuminate\View\Middleware\ShareErrorsFromSession',
    //'App\Http\Middleware\VerifyCsrfToken',   // <- turn this off
];

Nested field mappings

Let's take a look at this from examples:

class Event extends Eloquent implements UserInterface
{
protected static $facebook_field_aliases = [
//'facebook_field_name' => 'database_column_name',
'description' => 'description',
'id' => 'facebookId',
'start_time' => 'beginTime'
];
}

Would it be possible to use nested fields from facebook graph object in this mapping?
For example I have event graph object that in JSON looks like this:

{
"description": "Đorđe Balašević, jedan od najvećih kantautora u regiji, 25. aprila održat će koncert u Sarajevu, saznaje N1.Balašević će, četiri godine od posljednjeg koncerta u glavnom gradu BiH, ponovo napuniti Zetru.\nKantautor, reditelj, pjesnik i muzičar posljednji koncert u BiH održao je u Mostaru 5. jula 2013. godine. Nakon toga gostovao je diljem regije, a sada je ponovo odlučio "uploviti" u BiH sa svojom Panonskom mornaricom.Iako Đorđe Balašević koncerte održava dosta rijetko i selektivno, Sarajevo je grad koji ovaj vrhunski umjetnik uvijek odabere za domaćina svog nastupa. Brojni poklonici lika i djela ovog novosadskog pjesnika, kompozitora, pjevača…, 25. aprila će u Zetri moći uživati u velikom koncertu pod nazivom “Kad tamburama mangupi prepreče put...“ za koji u cijeloj regiji, ali i šire vlada ogromno interesovanje.Nastup će kao i uvijek pratiti besprijekorna tehnička podrška i nesvakidašnja scenografija.Organizator koncerta je Sarajevodisk.",
"is_date_only": false,
"location": "Zetra, Sarajevo",
"name": "Đorđe Balašević "Kad tamburama mangupi prepreče put..."",
"owner": {
"id": "10205257889439204",
"name": "Naser Luković"
},
"privacy": "OPEN",
"start_time": "2015-04-25T20:00:00+0200",
"timezone": "Europe/Sarajevo",
"updated_time": "2015-02-23T10:31:27+0000",
"venue": {
"city": "Kosevo",
"country": "Bosnia and Herzegovina",
"latitude": 43.871558867741,
"located_in": "437777029566008",
"longitude": 18.409353180232,
"street": "22/5 chi lang TP pleiku ting gia lai",
"zip": "71000",
"id": "292150107482237"
},
"id": "960026654009577"
}

And I am interested in the venue.street field and want to map it to database field street. Is this possible?

string(74) "(#803) Some of the aliases you requested do not exist:

Hi,

I am trying to post to a specific page with the following code but this return the error.

Facebook::setAccessToken('####################');
$page_id = ####################;
$data = array(
'link' => 'http://google.com/',
'message' => 'primer on geospatial data and mongodb',
);

    try {
        $facebook_event = Facebook::object('/' . $page_id . '/feed')->with($data)->post();
    } catch (\SammyK\FacebookQueryBuilder\FacebookQueryBuilderException $e) {
        dd($e->getPrevious()->getMessage());
    }

the Error is -
string(74) "(#803) Some of the aliases you requested do not exist:

About Facebook::getTokenFromRedirect()

i read about this instruction

there is a wrapper for getTokenFromRedirect() that defaults the callback URL to whatever is set in the config.

But when i set redirect_uri in config, the function Facebook::getLoginUrl() run normally with redirect_uri from config file

And when i using getTokenFromRedirect() without parameter, i getting error

Unable to obtain access token from redirect facebook

But if i set the paramter like this Facebook::getTokenFromRedirect(url('/whatever/link/'));

it's return token with experies date.

uploading photo to facebook

Hi Sammy,

nice job!

I'm looking for any example on how to upload a photo to facebook, using this package, but didn't found nothing about.

Can you hep me with it?

Thanks,

RA

FB Sdk Error while getting token from redirect

Facebook sdk access token problem

Came across this error when I try to call getTokenFromRedirect()

        try {
            $token = Facebook::getTokenFromRedirect();

            if (!$token) {
                return false;
            }
        } catch (SammyK\FacebookQueryBuilder\FacebookQueryBuilderException $e) {
            $error = [
                'FQB' => $e->getMessage(),
                'FB_SDK' => $e->getPrevious()->getMessage(),
            ];
            dd($error);
        }

        return $token;

I'm using "sammyk/laravel-facebook-sdk": "~1.1" with Laravel 4.2.
What could be the possible reason for this?

Thanks for your help!

getTokenFromCanvas

$token = Facebook::getTokenFromCanvas(); this function it is no define?? it does not exist in your laravel-facebook-sdk

I got this error from javascript sdk

I use js-sdk to login user
when user accept permission i use

window.location.href = "{{ action('UserController@login') }}"

on my UserController@login

public function login()
{
    $user = Facebook::object('me')->fields('id', 'email')->get();

    if ($user) {
        try {
            dd($user);
        } catch (FacebookQueryBuilderException $e){
            dd('error');
        }
    }

}

when it run it error

Method Facebook\Entities\AccessToken::__toString() must return a string value

Make update/create configurable for FacebookableTrait object

I have a case where I use this package for fetching events and their venues (locations) as a models (Eloquent) from Facebook. My Event model has one Location model. Inside Event, field facebookId gets mapped to ID field from Facebook Graph Event object. Inside Location, field event_id is foreign key to event, and field facebookVenueId is mapped to ID field from Facebook Graph Event Venue object. Whenever I add more events from same host (location), my location gets updated with event_id pointing to last event that I added. Therefore my events get lost. I could have used modeling of type "one location-> many events, but I don't see how that would fix the updates of the same Location object which is caused by this package method

FacebookableTrait::createOrUpdateFacebookObject()

It would be very useful if somehow we could make Eloquent models that use FacebookableTrait to configure whether that model is only updated, created or has currently implemented behavior of type update/create-new. I was looking into static method

/**
     * Like static::firstOrNew() but without mass assignment
     *
     * @param array $attributes
     * @return \Illuminate\Database\Eloquent\Model
     */
    public static function firstOrNewFacebookObject(array $attributes)
    {
        if (is_null($facebook_object = static::firstByAttributes($attributes)))
        {
            $facebook_object = new static();
        }

        return $facebook_object;
    }

but don't have ideas how this could be configurable? Actually, truth be told, I am working first time with Laravel, and I am still learning a lot. Anyways, I would be thankful to hear the opinion about the possible implementation or workaround ...

summary() modifier not display in Array

Since I want to get fan page's post like_count,
I use the summary() modifier, but it's not display in the array.

Facebook::object("cnn/posts/")->fields('likes.limit(1).summary(true)')->get()->toArray();

Need Paging information

I'm fetching new photos uploaded by user.

As facebook has response size limit of 2mb, I cannot pull all the photos in one call because some users have thousands of photos.

So I need paging information(as provided in javascript response of fb js sdk) to start a new api call to fetch the next set of photos.

Is there any way I can do that using this LaravelFacebookSdk or using FacebookPhpSdk ?

SammyK \ FacebookQueryBuilder \ FacebookQueryBuilderException (10) Graph returned an error response.

When using the following code Laravel 4 fired an exception :
Facebook::setAppCredentials('########', '#############');

    // This access token will be used for all calls to Graph.
    Facebook::setAccessToken('ff5ab5e96377be16436c9f2fe751b4c3');

    // Get the logged in user's profile.
    $user = Facebook::object('me')->fields('id', 'email')->get();

Exeception -
SammyK \ FacebookQueryBuilder \ FacebookQueryBuilderException (10) Graph returned an error response.

Search method not working

I get the following error when i try to access call search on the facade
Call to undefined method SammyK\LaravelFacebookSdk\LaravelFacebookSdk::object()
Does this mean not all FQB methods are defined on the Laravel Facade

Can't generate an access token after it expires

I use Laravel 4.2, so I've installed LaravelFacebookSdk 1.2 branch.

What I want to achieve is to get the posts from my facebook page and it works with this:

Facebook::object($my_app_id.'/posts')->fields('message')->get()

So here I have a section called My Apps where I can see my App ID and my App Secret which I use here:

Facebook::setAppCredentials($my_app_id, $my_app_secret);

On this page I generate an Access Token which I use here:

Facebook::setAccessToken($access_token);

Everything goes well until now, but my access_tocken expres after a while and I can't find a way to generate it again. Curently I store this token into the database because I use it every day.

I tried this:

    try {
        $token = Facebook::getTokenFromRedirect();
        print "success";
        print_r($token);die();
    }
    catch (FacebookQueryBuilderException $e)
    {
        // Failed to obtain access token
        echo 'Error:' . $e->getMessage();
    }

And on the screen I get only the success message printed without any access token. Can you help me with this please?

I added a stackoverflow question also regarding this.

I do all of this in my controller and I also added this line:

use SammyK\FacebookQueryBuilder\FacebookQueryBuilderException;

All FQB methods? getTokenFromJavascript() doesn't work?

Hi!
This is probably me doing something wrong: but I try to authenticate a user from the FB.js SDK.
Working with a redirect (without the fb.js SDK) works with:

$token = Facebook::getTokenFromRedirect();

However,

$token = Facebook::getTokenFromJavascript()

doesn't work. The function doesn't exists. What goes wrong here? The frontpage says "all Facebook Query Builder functions are supported".
I'm using version 1.2 as I'm on laravel 4.2
Thanks!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.