我的代碼如下:artdarek的OAuth的Facebook不起作用
Route::get('/facebook', '[email protected]');
public function socialConnect()
{
// get data from input
$code = Input::get('code');
// get fb service
$fb = OAuth::consumer('Facebook');
// check if code is valid
// if code is provided get user data and sign in
if (!empty($code)) {
// This was a callback request from facebook, get the token
$token = $fb->requestAccessToken($code);
// Send a request with it
$result = json_decode($fb->request('/me'), true);
$message = 'Your unique facebook user id is: ' . $result['id'] . ' and your name is ' . $result['name'];
echo $message. "<br/>";
//Var_dump
//display whole array().
dd($result);
}
// if not ask for permission first
else {
// get fb authorization
$url = $fb->getAuthorizationUri();
// return to facebook login url
return Redirect::to((string)$url);
}
}
錯誤:方法[的getData]上不存在重定向。
在調用http://localhost:8000/v1/facebook即使我加入有效的OAuth網址http://localhost:8000/v1/facebook重定向的URI
請建議相同
$duration = Benchmarking::end('application');
$duration = ($duration * 1000) . 'ms';
Log::info($response->getStatusCode() . ' ' . $request->path() . ' :: ' . $duration);
if (!Config::get('app.debug'))
{
return $response;
}
$data = $response->getData();
if (is_array($data)) {
return $response;
}
$data->queryLog = DB::getQueryLog();
$data->responseTime = $duration;
$response->setData($data);
return $response;
該過濾器產生什麼問題,我們才能它總是把這個錯誤固定它
雖然這可能會在理論上回答這個問題,[這將是更可取的](/ meta.stackoverflow.com/q/8259)包括的基本部分在這裏回答,並提供參考鏈接。 – GhostCat