dimanche 20 mars 2016

How to implement Socialite in Laravel 5.1

I try to implement http://ift.tt/1kNinWg at my Laravel 5.1 project.

So as I read at documentation I write: at services.php

'facebook' => [
        'client_id'     => '567898789',
        'client_secret' => 'e7055b8576508b4026098d3chhh41d98',
        'redirect'      => 'http://ift.tt/21BHlYg',
    ],

also at app.php I add:

    Laravel\Socialite\SocialiteServiceProvider::class,

and aliases:

'Socialite' => Laravel\Socialite\Facades\Socialite::class,

Now at AuthController I add:

public function redirectToProvider()
    {
        return Socialite::driver('facebook')
         ->scopes(['scope1', 'scope2'])->redirect();
    }

    /**
     * Obtain the user information from GitHub.
     *
     * @return Response
     */
    public function handleProviderCallback()
    {
        $user = Socialite::driver('facebook')->user();

        // $user->token;
    }

and route.php:

//Social Login
Route::get('auth/facebook', 'Auth\AuthController@redirectToProvider');
Route::get('auth/facebook/callback', 'Auth\AuthController@handleProviderCallback');

But NOW when I try to go at http://ift.tt/1R7ukEh I get:

enter image description here

NotFoundHttpException in Controller.php line 269: Controller method not found.

What is wrong? WHere I make error? Hw to solve this problem?



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire