58
58
59
59
```
60
60
61
- If the user is not set, then a ` PHPOpenSourceSaver\JWTAuth\Exceptions\UserNotDefinedException ` will be thrown
61
+ If the user is not set, then a ` PHPOpenSourceSaver\JWTAuth\Exceptions\UserNotDefinedException ` will be thrown.
62
62
63
63
### logout()
64
64
@@ -73,7 +73,7 @@ auth()->logout(true);
73
73
74
74
### refresh()
75
75
76
- Refresh a token, which invalidates the current one
76
+ Refresh a token, which invalidates the current one.
77
77
78
78
``` php
79
79
$newToken = auth()->refresh();
@@ -85,7 +85,7 @@ $newToken = auth()->refresh(true, true);
85
85
86
86
### invalidate()
87
87
88
- Invalidate the token (add it to the blacklist)
88
+ Invalidate the token (add it to the blacklist).
89
89
90
90
``` php
91
91
auth()->invalidate();
@@ -104,7 +104,7 @@ $token = auth()->tokenById(123);
104
104
105
105
### payload()
106
106
107
- Get the raw JWT payload
107
+ Get the raw JWT payload.
108
108
109
109
``` php
110
110
$payload = auth()->payload();
@@ -118,7 +118,7 @@ $payload->toArray(); // = ['sub' => 123, 'exp' => 123456, 'jti' => 'asfe4fq434as
118
118
119
119
### validate()
120
120
121
- Validate a user's credentials
121
+ Validate a user's credentials.
122
122
123
123
``` php
124
124
if (auth()->validate($credentials)) {
@@ -147,7 +147,8 @@ $user = auth()->setRequest($request)->user();
147
147
```
148
148
149
149
### Override the token ttl
150
+ This example sets the token to expire after 2 hours.
150
151
151
152
``` php
152
- $token = auth()->setTTL(7200 )->attempt($credentials);
153
+ $token = auth()->setTTL(120 )->attempt($credentials);
153
154
```
0 commit comments