29.07.2016 Views

laravel-5

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Authentication 156<br />

.<br />

1 'providers' => [<br />

2 // Other service providers...<br />

3<br />

4 Laravel\Socialite\SocialiteServiceProvider::class,<br />

5 ],<br />

Also, add the Socialite facade to the aliases array in your app configuration file:<br />

.<br />

1 'Socialite' => Laravel\Socialite\Facades\Socialite::class,<br />

You will also need to add credentials for the OAuth services your application utilizes. These<br />

credentials should be placed in your config/services.php configuration file, and should use the<br />

key facebook, twitter, linkedin, google, github or bitbucket, depending on the providers your<br />

application requires. For example:<br />

.<br />

1 'github' => [<br />

2 'client_id' => 'your-github-app-id',<br />

3 'client_secret' => 'your-github-app-secret',<br />

4 'redirect' => 'http://your-callback-url',<br />

5 ],<br />

Basic Usage<br />

Next, you are ready to authenticate users! You will need two routes: one for redirecting the user to<br />

the OAuth provider, and another for receiving the callback from the provider after authentication.<br />

We will access Socialite using the Socialite facade:<br />

.<br />

1

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!