dimanche 20 septembre 2015

Get user id from facebook with Laravel 5 Socialite

New guy here, I'm trying to get a facebook user id so I can display a link to their profile on my site, however with laravel socialite I get some id that is not the profile id, I don't realy know what it is, here is my setup, pretty basic stuff

public function getFbredirect() {
    return Socialite::driver('facebook')->redirect();
}

public function getFbredirectback() {
    $user = Socialite::driver('facebook')->user();

    Session::set('fbid', $user); // stands for fb identity

    return redirect(Session::has('backto') ? Session::get('backto') : '/');
}

Then when I dd(Session::get('fbid') I get this object

enter image description here

As you can see there is an id but it is not the id I expect, the profile id I expect starts with 1, the one I get starts with 9.

So the question is how can I get the user's profile id?



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire