<?php
namespace App\Http\Controllers;
use App\Models\VoteCat;
use Illuminate\Http\Request;
use SammyK;
use Facebook;
use App\Http\Requests;
class VoteUserController extends Controller
{
public function index(SammyK\LaravelFacebookSdk\LaravelFacebookSdk $fb)
{
try {
$token = $fb->getAccessTokenFromRedirect();
} catch (Facebook\Exceptions\FacebookSDKException $e) {
// Failed to obtain access token
dd($e->getMessage());
}
// $token will be null if the user denied the request
if (! $token) {
// User denied the request
}
// Send an array of permissions to request
$login_url = $fb->getLoginUrl(['email']);
$response = $fb->get($login_url);
$eventNode = $response->getGraphEvent();
$user = $response->getGraphUser();
echo 'Name: ' . $user['email'];
}
}
// $token will be null if the user denied the request
if (! $token) {
// User denied the request
} else {
// set valid $token as default access token
$fb->setDefaultAccessToken($token);
}
This is my controller
Got
How should I provide this access token.