Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/awes-io/auth
🔑 Laravel Authentication package with built-in two-factor (Authy) and social authentication (Socialite).
https://github.com/awes-io/auth
2fa auth authentication authorisation authorization authy laravel registration socialite
Last synced: 5 days ago
JSON representation
🔑 Laravel Authentication package with built-in two-factor (Authy) and social authentication (Socialite).
- Host: GitHub
- URL: https://github.com/awes-io/auth
- Owner: awes-io
- License: mit
- Created: 2019-05-31T16:51:51.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2019-10-10T17:20:10.000Z (over 5 years ago)
- Last Synced: 2024-06-21T14:30:48.935Z (8 months ago)
- Topics: 2fa, auth, authentication, authorisation, authorization, authy, laravel, registration, socialite
- Language: PHP
- Homepage:
- Size: 142 KB
- Stars: 38
- Watchers: 5
- Forks: 1
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- Changelog: changelog.md
- Contributing: CONTRIBUTING.md
- Funding: .github/FUNDING.yml
- License: LICENSE
- Code of conduct: CODE_OF_CONDUCT.md
Awesome Lists containing this project
README
Authentication
Laravel Authentication package with built-in two-factor (Authy) and social authentication (Socialite).
##
![]()
## Table of Contents
- Installation
- Configuration
- Social and two-factor authentication
- Email verification & resetting passwords
- Usage
- Testing## Installation
Via Composer
``` bash
$ composer require awes-io/auth
```The package will automatically register itself.
You can publish migrations:
```bash
php artisan vendor:publish --provider="AwesIO\Auth\AuthServiceProvider" --tag="migrations"
```After migrations have been published you can create required db tables by running:
```bash
php artisan migrate
```Publish views:
```bash
php artisan vendor:publish --provider="AwesIO\Auth\AuthServiceProvider" --tag="views"
```## Configuration
Publish config file:
```bash
php artisan vendor:publish --provider="AwesIO\Auth\AuthServiceProvider" --tag="config"
```You can disable additional features by commenting them out:
```php
'enabled' => [
'social',
// 'two_factor',
// 'email_verification',
],
```Add new socialite services:
```php
'services' => [
'github' => [
'name' => 'GitHub'
],
...
],
'github' => [
'client_id' => env('GITHUB_CLIENT_ID'),
...
],
```And configure redirect paths:
```php
'redirects' => [
'login' => '/twofactor',
'reset_password' => '/',
...
],
```### Social and two-factor authentication
Several .env variables required if additional modules were enabled in config:
```php
# SOCIALITE GITHUB
GITHUB_CLIENT_ID=
GITHUB_CLIENT_SECRET=
GITHUB_REDIRECT_URL=http://auth.test/login/github/callback# TWO FACTOR AUTHY
AUTHY_SECRET=
```If you enabled social and/or two factor authentication add respective traits to User model class:
```php
use AwesIO\Auth\Models\Traits\HasSocialAuthentication;
use AwesIO\Auth\Models\Traits\HasTwoFactorAuthentication;class User extends Authenticatable
{
use HasSocialAuthentication, HasTwoFactorAuthentication;
}
```### Email verification & resetting passwords
To use email verification functionality and to reset passwords, add `SendsEmailVerification` and `SendsPasswordReset` traits:
```php
use AwesIO\Auth\Models\Traits\SendsPasswordReset;
use AwesIO\Auth\Models\Traits\SendsEmailVerification;class User extends Authenticatable
{
use SendsEmailVerification, SendsPasswordReset;
}
```## Usage
Add to routes/web.php:
```php
AwesAuth::routes();
```You can disable registration:
```php
AwesAuth::routes(['register' => false]);
```Package will register several routes.
##### Besides default authentication routes, it will add:
* Socialite routes
* `'login.social'`
* `'login/{service}/callback'`
* Two factor authentication setup routes
* `'twofactor.index'`
* `'twofactor.store'`
* `'twofactor.destroy'`
* `'twofactor.verify'`
* Two factor authentication login routes
* `'login.twofactor.index'`
* `'login.twofactor.verify'`
* Email verification routes
* `'verification.resend'`
* `'verification.code.verify'`
* `'verification.code'`
* `'verification.verify'`## Testing
You can run the tests with:
```bash
composer test
```## Contributing
Please see [contributing.md](contributing.md) for details and a todolist.
## Credits
- [Galymzhan Begimov](https://github.com/begimov)
- [All Contributors](contributing.md)## License
[MIT](http://opensource.org/licenses/MIT)