https://github.com/overtrue/laravel-socialite
:octocat: Social OAuth Authentication for Laravel 5. drivers: facebook, github, google, linkedin, weibo, qq, wechat and douban
https://github.com/overtrue/laravel-socialite
facebook google laravel-socialite linkedin social-login socialite wechat weibo
Last synced: 23 days ago
JSON representation
:octocat: Social OAuth Authentication for Laravel 5. drivers: facebook, github, google, linkedin, weibo, qq, wechat and douban
- Host: GitHub
- URL: https://github.com/overtrue/laravel-socialite
- Owner: overtrue
- Created: 2015-12-09T23:23:31.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2024-03-13T05:06:10.000Z (about 1 year ago)
- Last Synced: 2025-04-01T10:14:44.024Z (30 days ago)
- Topics: facebook, google, laravel-socialite, linkedin, social-login, socialite, wechat, weibo
- Language: PHP
- Homepage:
- Size: 29.3 KB
- Stars: 340
- Watchers: 8
- Forks: 47
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Funding: .github/FUNDING.yml
Awesome Lists containing this project
README
# Laravel Socialite



[](https://github.com/sponsors/overtrue)
# Installation
```
$ composer require "overtrue/laravel-socialite"
```> if you have been installed the `overtrue/socialite` package, please remove it from `composer.json` before this command.
# Configuration
1. You will also need to add credentials for the OAuth services your application utilizes. These credentials should be placed in your `config/socialite.php` or `config/services.php` configuration file, and should use the key facebook, twitter, linkedin, google, github or bitbucket, depending on the providers your application requires. For example:
```php
[
'client_id' => 'your-app-id',
'client_secret' => 'your-app-secret',
'redirect' => 'http://localhost/socialite/callback.php',
],
//...
];
```# Usage
```php
to(Socialite::create('github')->redirect());
}/**
* Obtain the user information from GitHub.
*/
public function handleProviderCallback(Request $request)
{
$user = Socialite::create('github')->userFromCode($request->query('code'));// $user->getId();
// $user->getNickname();
// ...
}
}
```And register routes:
```php
Route::get('/oauth/github', 'AuthController@redirectToProvider');
Route::get('/oauth/github/callback', 'AuthController@handleProviderCallback');
```About more usage, please refer to [overtrue/socialite](https://github.com/overtrue/socialite).
## :heart: Sponsor me
[](https://github.com/sponsors/overtrue)
如果你喜欢我的项目并想支持它,[点击这里 :heart:](https://github.com/sponsors/overtrue)
## Project supported by JetBrains
Many thanks to Jetbrains for kindly providing a license for me to work on this and other open-source projects.
[](https://www.jetbrains.com/?from=https://github.com/overtrue)
## PHP 扩展包开发
> 想知道如何从零开始构建 PHP 扩展包?
>
> 请关注我的实战课程,我会在此课程中分享一些扩展开发经验 —— [《PHP 扩展包实战教程 - 从入门到发布》](https://learnku.com/courses/creating-package)# License
MIT