-
Notifications
You must be signed in to change notification settings - Fork 3
1. Install & config
dungda-0794 edited this page Feb 7, 2023
·
5 revisions
composer require sun-asterisk/php-auth<?php
namespace App\Http\Controllers;
use Illuminate\Http\Request;
use SunAsterisk\Auth\Contracts\AuthJwtService;
class AuthController extends Controller
{
protected AuthJwtService $service;
public function __construct(AuthJwtService $service)
{
$this->service = $service;
}
...
}<?php
return [
'auth' => [
/*
| E.g. 'email or username'
*/
'login_username' => 'email',
/*
| E.g. 'password or passwd'
*/
'login_password' => 'password',
/*
| E.g. 'App\Models\User::class or App\Models\Admin::class'
*/
'model' => App\Models\User::class,
/*
| Default 5 minutes
| E.g. '5'
*/
'token_expires' => 5, // minutes
/*
| E.g. 'xxxx'
*/
'jwt_key' => 'jwt_key',
/*
| E.g. 'xxxx'
*/
'jwt_refresh_key' => 'jwt_refresh_key',
/*
| Default 60 minutes
| E.g. '60'
*/
'jwt_ttl' => 60, // minutes
/*
| Default 20160 minutes
| E.g. '60'
*/
'jwt_refresh_ttl' => 20160 // minutes,
],
];