Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/mckenziearts/laravel-oauth
:octocat: Social OAuth authentication for Laravel 5 & 6. Drivers: Facebook, Twitter, Google, LinkedIn, Github, Bitbucket.
https://github.com/mckenziearts/laravel-oauth
laravel laravel-socialite oauth oauth2-authentication php social-login social-oauth-authentication socialite
Last synced: 4 months ago
JSON representation
:octocat: Social OAuth authentication for Laravel 5 & 6. Drivers: Facebook, Twitter, Google, LinkedIn, Github, Bitbucket.
- Host: GitHub
- URL: https://github.com/mckenziearts/laravel-oauth
- Owner: mckenziearts
- License: other
- Created: 2018-06-29T23:07:48.000Z (about 6 years ago)
- Default Branch: master
- Last Pushed: 2019-09-29T07:26:28.000Z (almost 5 years ago)
- Last Synced: 2024-01-18T23:11:29.237Z (6 months ago)
- Topics: laravel, laravel-socialite, oauth, oauth2-authentication, php, social-login, social-oauth-authentication, socialite
- Language: PHP
- Homepage:
- Size: 179 KB
- Stars: 52
- Watchers: 4
- Forks: 6
- Open Issues: 0
-
Metadata Files:
- Readme: readme.md
- Changelog: changelog.md
- Contributing: contributing.md
- License: license.md
Lists
- docsify-awesome-stars - mckenziearts/laravel-oauth - :octocat: Social OAuth authentication for Laravel 5 & 6. Drivers: Facebook, Twitter, Google, LinkedIn, Github, Bitbucket. (PHP)
- awesome-jekyll - mckenziearts/laravel-oauth - :octocat: Social OAuth authentication for Laravel 5 & 6. Drivers: Facebook, Twitter, Google, LinkedIn, Github, Bitbucket. (PHP)
- awesome-stars - mckenziearts/laravel-oauth - :octocat: Social OAuth authentication for Laravel 5 & 6. Drivers: Facebook, Twitter, Google, LinkedIn, Github, Bitbucket. (PHP)
README
[![Latest Version on Packagist][ico-version]][link-packagist]
[![Total Downloads][ico-downloads]][link-downloads]
[![Build Status](https://scrutinizer-ci.com/g/Mckenziearts/laravel-oauth/badges/build.png?b=master)](https://scrutinizer-ci.com/g/Mckenziearts/laravel-oauth/build-status/master)
[![Scrutinizer Code Quality](https://scrutinizer-ci.com/g/Mckenziearts/laravel-oauth/badges/quality-score.png?b=master)](https://scrutinizer-ci.com/g/mckenziearts/laravel-oauth/?branch=master)
[![StyleCI][ico-styleci]][link-styleci]## Introduction
Social OAuth authentication for Laravel 5 which provides oAuth support in PHP 5.3+ and is very easy to integrate with any project which requires an oAuth client. This package use [Laravel Socialite](https://github.com/laravel/socialite). For Laravel 4 look this [package](https://github.com/artdarek/oauth-4-laravel)
## Supported services
The library supports OAuth 2.0 compliant services. A list of currently implemented services can be found below. More services will be implemented soon.
Included service implementations:
- OAuth2
- GitHub
- Bitbucket
- Dribbble
- Youtube
- Gitlab
- more to come!Laravel Support version
| **Laravel** | **laravel-oauth** |
|---|---|
| <=5.5 | ^1.0 |
| 6.0 | ^1.1 |## Installation
1. Include the package in your project using Composer
``` shell
$ composer require mckenziearts/laravel-oauth
```2. Add the service provider to your `config/app.php` providers array:
**For Laravel 5.5.+ - you're done.**
```php
Mckenziearts\LaravelOAuth\LaravelOAuthServiceProvider::class,
```
3. Publish the Vendor Assets files by running:```shell
php artisan vendor:publish --provider="Mckenziearts\LaravelOAuth\LaravelOAuthServiceProvider"
```4. Now that we have published a few new files to our application we need to reload them with the following command:
```shell
composer dump-autoload
```
## ConfigurationWhen you published the vendor assets you added a new file inside of your `config` folder which is called `config/laravel-oauth.php`. This file contains a bunch of configuration you can use to configure your connexion using social networks.
First, you have to add your service like is defined on The official documentation of Socialite [available here](https://laravel.com/docs/5.6/socialite#configuration). Just setup your
Oauth services for your application. Laravel/socialite is automatically installed by this package.
## Usage1. Fisrt of all in the `config/laravel-oauth.php` file you must define the default users table name to simplify migrations. By default users table is used
```php
'users' => [
'table' => 'users',
],
```
2. Secondly you must specify the providers to use for social login in the `providers` array. To active a provider set the value to `true````php
'providers' => [
'facebook' => true,
'google' => true,
'github' => true,
],
```
The last configuration is to stylize the button by editing class name and add or remove icon![](https://pix.watch/m3qMiw/Q8fKIi.png)
Next, if you may want to re-publish the laravel-oauth assets, config, and the migrations run the following command:
```
php artisan vendor:publish --tag=laravel-oauth.assets --force
php artisan vendor:publish --tag=laravel-oauth.config --force
php artisan vendor:publish --tag=laravel-oauth.migrations --force
```3. Next to make sure you have the latest database schema run:
```
php artisan migrate
```4. Inside of your master.blade.php file include a header yield. Inside the head of your master or app.blade.php add the following:
```
@yield('css')
```5. Add the blade directive to your view where you want to display the socials buttons. The directive takes a parameter `login` to display the login text or `resgister` for the text related to the registration
```
@socialite('login')
```6. Add the style of the buttons by adding this to your view in the section in the `@yield('css')` who defined in your master layout
```
@section('css')
@endsection
```7. In the `Auth\LoginController` of your application, add the `OAuthSocialite` trait:
```php
namespace App\Http\Controllers\Auth;
use App\Http\Controllers\Controller;
use Illuminate\Foundation\Auth\AuthenticatesUsers;
use Mckenziearts\LaravelOAuth\Traits\OAuthSocialite;
class LoginController extends Controller
{
use OAuthSocialite;
..
```
With this feature you can overwrite the present methods on the trait if you want to customize them even more8. Add this routes to your default web route file
```php
Route::get('/auth/{provider}', 'Auth\LoginController@redirectToProvider');
Route::get('/callback/{provider}', 'Auth\LoginController@handleProviderCallback');
```## Change log
Please see the [changelog.md](changelog.md) for more information on what has changed recently.
## Testing
``` bash
$ composer test
```## Contributing
Please see [contributing.md](contributing.md) for details and a todolist.
## Security
If you discover any security related issues, please email [email protected] instead of using the issue tracker.
## Credits
- [Arthur Monney](https://www.twitter.com/monneyarthur)
- [Laravel Socialite](https://laravel.com/docs/5.6/socialite)## License
MIT. Please see the [license.md](license.md) for more information.
[ico-version]: https://img.shields.io/packagist/v/mckenziearts/laravel-oauth.svg?style=flat-square
[ico-downloads]: https://img.shields.io/packagist/dt/mckenziearts/laravel-oauth.svg?style=flat-square
[ico-travis]: https://img.shields.io/travis/mckenziearts/laravel-oauth/master.svg?style=flat-square
[ico-styleci]: https://styleci.io/repos/139203549/shield[link-packagist]: https://packagist.org/packages/mckenziearts/laravel-oauth
[link-downloads]: https://packagist.org/packages/mckenziearts/laravel-oauth
[link-travis]: https://travis-ci.org/Mckenziearts/laravel-oauth
[link-styleci]: https://styleci.io/repos/139203549
[link-author]: https://github.com/mckenziearts
[link-contributors]: ../../contributors]