We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent d34dc0e commit 5b19073Copy full SHA for 5b19073
2 files changed
.env.example
@@ -9,6 +9,9 @@ APP_VERSION=1
9
# Application environment
10
APP_ENVIRONMENT=development
11
12
+# Authentication token lifetime in seconds
13
+AUTH_TOKE_LIFE_TIME=86400
14
+
15
# CONNECTIVITY
16
17
# Server host ip
src/Auth/Token.php
@@ -9,16 +9,9 @@
final class Token
{
- /**
- * Expiry time of token
- * Default = 24 * 60 * 60
- * @var int $expiryTime
- */
- private static int $expiryTime = 8640;
18
-
19
public static function encode(array $user): string
20
21
- $user['expiry'] = time() + self::$expiryTime;
+ $user['expiry'] = time() + $_ENV['AUTH_TOKE_LIFE_TIME'];
22
return JWT::encode(payload: $user, key: self::getAppKey(), alg: 'HS256');
23
}
24
0 commit comments