File tree Expand file tree Collapse file tree 3 files changed +30
-1
lines changed Expand file tree Collapse file tree 3 files changed +30
-1
lines changed Original file line number Diff line number Diff line change @@ -12,6 +12,17 @@ Passport 12.0 no longer automatically loads migrations from its own migrations d
12
12
php artisan vendor:publish --tag=passport-migrations
13
13
```
14
14
15
+ ### Password Grant Type
16
+
17
+ The password grant type is disabled by default. You may enable it by calling the ` enablePasswordGrant ` method in the ` boot ` method of your application's ` App\Providers\AppServiceProvider ` class:
18
+
19
+ ``` php
20
+ public function boot(): void
21
+ {
22
+ Passport::enablePasswordGrant();
23
+ }
24
+ ```
25
+
15
26
## Upgrading To 11.0 From 10.x
16
27
17
28
### Minimum PHP Version
Original file line number Diff line number Diff line change @@ -26,7 +26,7 @@ class Passport
26
26
*
27
27
* @var bool|null
28
28
*/
29
- public static $ passwordGrantEnabled = true ;
29
+ public static $ passwordGrantEnabled = false ;
30
30
31
31
/**
32
32
* The default scope.
@@ -196,6 +196,18 @@ public static function enableImplicitGrant()
196
196
return new static ;
197
197
}
198
198
199
+ /**
200
+ * Enable the password grant type.
201
+ *
202
+ * @return static
203
+ */
204
+ public static function enablePasswordGrant ()
205
+ {
206
+ static ::$ passwordGrantEnabled = true ;
207
+
208
+ return new static ;
209
+ }
210
+
199
211
/**
200
212
* Set the default scope(s). Multiple scopes may be an array or specified delimited by spaces.
201
213
*
Original file line number Diff line number Diff line change @@ -106,6 +106,8 @@ public function testGettingAccessTokenWithPasswordGrant()
106
106
{
107
107
$ this ->withoutExceptionHandling ();
108
108
109
+ Passport::enablePasswordGrant ();
110
+
109
111
$ password = 'foobar123 ' ;
110
112
$ user = UserFactory::new ()->create ([
111
113
@@ -153,6 +155,8 @@ public function testGettingAccessTokenWithPasswordGrant()
153
155
154
156
public function testGettingAccessTokenWithPasswordGrantWithInvalidPassword ()
155
157
{
158
+ Passport::enablePasswordGrant ();
159
+
156
160
$ password = 'foobar123 ' ;
157
161
$ user = UserFactory::new ()->create ([
158
162
@@ -196,6 +200,8 @@ public function testGettingAccessTokenWithPasswordGrantWithInvalidPassword()
196
200
197
201
public function testGettingAccessTokenWithPasswordGrantWithInvalidClientSecret ()
198
202
{
203
+ Passport::enablePasswordGrant ();
204
+
199
205
$ password = 'foobar123 ' ;
200
206
$ user = UserFactory::new ()->create ([
201
207
You can’t perform that action at this time.
0 commit comments