2014-05-08 56 views
0

嗨,我是laravel 4 begginer。Laravel 4 - Artadarek/OAuth-4-laravel問題

我嘗試使用Artadek/OAuth的4 laravel包 一切都使用的是什麼,我做了例子很順利,直到:

路線:

Route::get('lfb', array(
    'as' => 'lfb', 
    'uses' => '[email protected]' 

)); 

控制器:

class HomeController extends BaseController { 
public function signInWithFacebook() { 

     // 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); 
     } 

    } 

和刀片:

@extends('layout.main') 

@section('content') 
<a href="{{ URL::route('lfb') }}">Sign in with Facebook</a> 
@stop 
從laravel.log

最後一個錯誤日誌:

Symfony \ Component \ HttpKernel \ Exception \ NotFoundHttpException 

open: F:\wamp\www\IbidsLR\bootstrap\compiled.php 

    { 
    $routes = $this->get($request->getMethod()); 
    $route = $this->check($routes, $request); 
    if (!is_null($route)) { 
    return $route->bind($request); 
    } 
    $this->checkForAlternateVerbs($request); 
    throw new NotFoundHttpException(); 
    } 
    protected function checkForAlternateVerbs($request) 

,我得到的時候按一下按鈕「哎呦,財產以後出了問題。」它將我重定向到lfb頁面,我沒有任何頁面調用該名稱我只是想使用fb登錄..

這裏有什麼錯?

回答

1

去你的laravel文件夾,然後打開app/config/app.php並確保'debug' => 'true',它會幫助你顯示你現在有什麼樣的錯誤。

它正在與您的路線和signInWithFacebook()功能正常工作。確保你已經爲Artadek/OAuth-4-laravel包創建了一個配置文件,它將在app/config/packages

它顯示lfb頁面,因爲這是你的路線 - 你的功能將與它一起工作。

請確保調試已打開並再次檢查您的錯誤。這很難用「哎呀,出了點問題」來解釋。

+0

感謝您的幫助,我現在打開調試到真正的,我已經與我的祕密身份證和應用程序ID的配置文件,我會更新我的問題與最新的錯誤,我得到也許你可以幫助我進一步的感謝。 – Ravg