File tree Expand file tree Collapse file tree 2 files changed +4
-2
lines changed
Expand file tree Collapse file tree 2 files changed +4
-2
lines changed Original file line number Diff line number Diff line change 11# API URL
22APP_URL="http://localhost:8080"
33
4+ # JSON Web Token
45JWT_KEY=""
6+ JWT_TOKEN_EXPIRATION="86400" # in seconds
57JWT_ALGO_ENCRYPTION="HS512"
68
79# Database details
Original file line number Diff line number Diff line change @@ -17,7 +17,7 @@ class User
1717{
1818 public const DATE_TIME_FORMAT = 'Y-m-d H:i:s ' ;
1919
20- public function login (mixed $ data )
20+ public function login (mixed $ data ): array
2121 {
2222 $ userValidation = new UserValidation ($ data );
2323 if ($ userValidation ->isLoginSchemaValid ()) {
@@ -32,7 +32,7 @@ public function login(mixed $data)
3232 [
3333 'iss ' => $ _ENV ['APP_URL ' ],
3434 'iat ' => $ currentTime ,
35- 'exp ' => $ currentTime + ( 60 * 60 ), // valid for an hour
35+ 'exp ' => $ currentTime + $ _ENV [ ' JWT_TOKEN_EXPIRATION ' ],
3636 'data ' => [
3737 'email ' => $ data ->email ,
3838 'name ' => $ userName
You can’t perform that action at this time.
0 commit comments