Changeset View
Changeset View
Standalone View
Standalone View
src/app/Http/Controllers/API/AuthController.php
Show All 40 Lines | class AuthController extends Controller | ||||
public static function logonResponse(User $user, string $password, string $secondFactor = null) | public static function logonResponse(User $user, string $password, string $secondFactor = null) | ||||
{ | { | ||||
$proxyRequest = Request::create('/oauth/token', 'POST', [ | $proxyRequest = Request::create('/oauth/token', 'POST', [ | ||||
'username' => $user->email, | 'username' => $user->email, | ||||
'password' => $password, | 'password' => $password, | ||||
'grant_type' => 'password', | 'grant_type' => 'password', | ||||
'client_id' => \config('auth.proxy.client_id'), | 'client_id' => \config('auth.proxy.client_id'), | ||||
'client_secret' => \config('auth.proxy.client_secret'), | 'client_secret' => \config('auth.proxy.client_secret'), | ||||
'scopes' => '[*]', | 'scope' => 'api', | ||||
'secondfactor' => $secondFactor | 'secondfactor' => $secondFactor | ||||
]); | ]); | ||||
$proxyRequest->headers->set('X-Client-IP', request()->ip()); | $proxyRequest->headers->set('X-Client-IP', request()->ip()); | ||||
$tokenResponse = app()->handle($proxyRequest); | $tokenResponse = app()->handle($proxyRequest); | ||||
return self::respondWithToken($tokenResponse, $user); | return self::respondWithToken($tokenResponse, $user); | ||||
} | } | ||||
▲ Show 20 Lines • Show All 140 Lines • Show Last 20 Lines |