PHPackages                             wamesk/laravel-auth - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. wamesk/laravel-auth

ActiveLibrary

wamesk/laravel-auth
===================

OAuth2 authorization with API endpoints. Also includes registration process, login, password reset, email validation.

5.0.7(9mo ago)0617MITPHP

Since Jan 19Pushed 9mo ago1 watchersCompare

[ Source](https://github.com/wamesk/laravel-auth)[ Packagist](https://packagist.org/packages/wamesk/laravel-auth)[ RSS](/packages/wamesk-laravel-auth/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (10)Dependencies (1)Versions (38)Used By (0)

Laravel Auth
============

[](#laravel-auth)

Sanctum authorization with API endpoints.

Also includes registration process, login, password reset, email validation.

Setup
=====

[](#setup)

```
composer require wamesk/laravel-auth
```

Add the service provider to array of providers in `config/app.php`

```
'providers' => [
    ...
    /*
     * Third Party Service Providers...
     */
    \Wame\LaravelAuth\LaravelAuthServiceProvider::class,
];
```

Make sure you have \\App\\Models\\User class. If you have it with different namespace or classname you can change it in config/wame-auth.php

```
'model' => 'App\\Models\\User' // Change it here when needed
```

Make changes to the `config/auth.php` file:

```
'guards' => [
    'web' => [
        'driver' => 'session',
        'provider' => 'users',
    ],

    // Add lines below
    'api' => [
        'driver' => 'passport',
        'provider' => 'users',
    ],
],
```

Make changes to the `config/passport.php` file:

```
'guard' => 'api', // Change value to 'api'

'password_grant_client' => [ // Password Grant Client - Login/Registration
    'id' => env('PASSPORT_PASSWORD_GRANT_CLIENT_ID'),
    'secret' => env('PASSPORT_PASSWORD_GRANT_CLIENT_SECRET'),
],

'personal_access_client' => [ // Personal Access Client - Social
    'id' => env('PASSPORT_PERSONAL_ACCESS_CLIENT_ID'),
    'secret' => env('PASSPORT_PERSONAL_ACCESS_CLIENT_SECRET'),
],
```

Make changes in migrations `database/migrations/2023_01_17_074644_create_activity_log_table.php`:

```
$table->bigIncrements('id');
$table->string('log_name')->nullable();
$table->text('description');
$table->nullableUlidMorphs('subject', 'subject'); // nullableUlidMorphs('causer', 'causer');   // json('properties')->nullable();
$table->timestamps();
$table->index('log_name');
```

Optionally make changes to the `config/eloquent-sortable.php` file:

```
 'order_column_name' => 'sort_order',
```

Run migrations

```
php artisan migrate
```

Setup OAuth2
------------

[](#setup-oauth2)

```
php artisan passport:install
```

Set passport output in `.env` file:

```
PASSPORT_PERSONAL_ACCESS_CLIENT_ID=
PASSPORT_PERSONAL_ACCESS_CLIENT_SECRET=

PASSPORT_PASSWORD_GRANT_CLIENT_ID=
PASSPORT_PASSWORD_GRANT_CLIENT_SECRET=
```

Configuration
=============

[](#configuration)

This is the content of the file that will be published in `config/wame-auth.php`

```
