aboutsummaryrefslogtreecommitdiffhomepage
path: root/infrastructure
diff options
context:
space:
mode:
Diffstat (limited to 'infrastructure')
-rw-r--r--infrastructure/Auth/AuthServiceProvider.php4
-rw-r--r--infrastructure/Auth/LoginProxy.php10
2 files changed, 8 insertions, 6 deletions
diff --git a/infrastructure/Auth/AuthServiceProvider.php b/infrastructure/Auth/AuthServiceProvider.php
index 944f812..66e0d78 100644
--- a/infrastructure/Auth/AuthServiceProvider.php
+++ b/infrastructure/Auth/AuthServiceProvider.php
@@ -34,8 +34,8 @@ class AuthServiceProvider extends ServiceProvider
$router->forTransientTokens();
});
- Passport::tokensExpireIn(Carbon::now()->addMinutes(10));
+ Passport::tokensExpireIn(Carbon::now()->addDays(365));
- Passport::refreshTokensExpireIn(Carbon::now()->addDays(10));
+ Passport::refreshTokensExpireIn(Carbon::now()->addDays(365));
}
} \ No newline at end of file
diff --git a/infrastructure/Auth/LoginProxy.php b/infrastructure/Auth/LoginProxy.php
index 11783f0..817b49d 100644
--- a/infrastructure/Auth/LoginProxy.php
+++ b/infrastructure/Auth/LoginProxy.php
@@ -22,7 +22,8 @@ class LoginProxy
private $userRepository;
- public function __construct(Application $app, UserRepository $userRepository) {
+ public function __construct(Application $app, UserRepository $userRepository)
+ {
$this->userRepository = $userRepository;
$this->apiConsumer = $app->make('apiconsumer');
@@ -43,10 +44,11 @@ class LoginProxy
$user = $this->userRepository->getWhere('email', $email)->first();
if (!is_null($user)) {
- return $this->proxy('password', [
+ $TokenObject = $this->proxy('password', [
'username' => $email,
'password' => $password
]);
+ return array_merge($TokenObject, ['user_data' => json_decode(json_encode($user), true)]);
}
throw new InvalidCredentialsException();
@@ -74,9 +76,9 @@ class LoginProxy
public function proxy($grantType, array $data = [])
{
$data = array_merge($data, [
- 'client_id' => env('PASSWORD_CLIENT_ID'),
+ 'client_id' => env('PASSWORD_CLIENT_ID'),
'client_secret' => env('PASSWORD_CLIENT_SECRET'),
- 'grant_type' => $grantType
+ 'grant_type' => $grantType
]);
$response = $this->apiConsumer->post('/oauth/token', $data);