From 6de7038f83c0bd73d6cbace221d816f0eda38318 Mon Sep 17 00:00:00 2001 From: Toby Zerner Date: Sat, 2 Jan 2016 15:22:53 +1030 Subject: [PATCH] Allow setting the token lifetime --- src/Api/Controller/TokenController.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/Api/Controller/TokenController.php b/src/Api/Controller/TokenController.php index a2c901c2d..9eb198a50 100644 --- a/src/Api/Controller/TokenController.php +++ b/src/Api/Controller/TokenController.php @@ -57,6 +57,7 @@ class TokenController implements ControllerInterface $identification = array_get($body, 'identification'); $password = array_get($body, 'password'); + $lifetime = array_get($body, 'lifetime', 3600); $user = $this->users->findByIdentification($identification); @@ -64,7 +65,7 @@ class TokenController implements ControllerInterface throw new PermissionDeniedException; } - $token = AccessToken::generate($user->id); + $token = AccessToken::generate($user->id, $lifetime); $token->save(); return (new JsonResponse([