2016-08-30 2 views
0

Laravel 5.1에 Socialite 플러그인을 설치하는 데 큰 문제가 있습니다. 내 도메인을하려고 할 때Laravel 통합 사회자 5.1 InvalidState 문제

Route::get('/social/login/redirect/{provider}', ['uses' => 'Auth\[email protected]', 'as' => 'social.login']); 
Route::get('/social/login/{provider}', 'Auth\[email protected]'); 

지금 :

public function redirectToProvider($provider) 
    { 
     return Socialite::driver($provider)->redirect(); 
    } 

    public function handleProviderCallback($provider) 
{ 
//notice we are not doing any validation, you should do it 

    $user = Socialite::driver($provider)->user(); 

    // stroing data to our use table and logging them in 
    $data = [ 
     'name' => $user->getName(), 
     'email' => $user->getEmail() 
    ]; 

    // Here, check if the user already exists in your records 

    $my_user = User::where('email','=', $user->getEmail())->first(); 
    if($my_user === null) { 
      Auth::login(User::firstOrCreate($data)); 
    } else { 
     Auth::login($my_user); 
    } 

    //after login redirecting to home page 
    return redirect($this->redirectPath()); 
} 

및 route.php :

먼저 나는이 AuthCOntroller.php 코드가 http://mydomain.me/social/login/redirect/facebook

나를 돌아

:

http://mydomain.me/social/login/facebook?code=AQAl29aq2-rX9L5-9GmiIwqstR-ETC ETC ETC#_=_ 

오류 : enter image description here

여기서 어떤 문제가 발생합니까?

내가 시도 : 시도도 session.php에서 'mydomain.me'에 널 (null)에서 도메인을 변경하고 :

php artisan cache:clear 
php artisan config:clear 
php artisan route:clear 
php artisan clear-compiled 

말라가 다시 작동 ... 내가이 문제를 해결하기 위해 도와주세요!

답변

1
  1. 세션 드라이버를 어떻게 설정합니까? 배열이면 배열이 작동하지 않습니다. 세션이 응용 프로그램에서 완전히 작동하는지 확인할 수 있습니까?
  2. 검색어 문자열이 /social/login/facebook에 다시 도착하지 않는 것처럼 보입니다. 리디렉션 URL에 검색어 문자열이 표시 될 수 있습니다 (예 : 페이스 북 로그인 페이지가 표시됨)?
  3. 또한 Facebook 앱 설정을 확인하고 사이트와 일치하는 콜백 URL을 확인해야합니다.
+0

아니요, 문제가 무엇인지 알지 못합니다 ... 10 일 동안이 문제를 해결하려고합니다 !!! –

+0

내 질문에 아무런 대답도하지 않았습니다. – fire

+0

1. 기본 로그인 작업이 좋습니다. 2. 예. .me/social/login/facebook 같은 쿼리 문자열을 봅니다. code = AQAl29aq2-rX9L5-9GmiIwqstR-ETC 기타 # _ = _ 3. fb 앱은 정상입니다. 모든 것이 평소와 같이 설정됩니다 ... 같은 코드 다른 응용 프로그램에서 잘 작동합니다. –