Skip to content

Commit 7ca8c94

Browse files
committed
Document default scope in Passport
1 parent f499cfe commit 7ca8c94

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

passport.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
- [Passing The Access Token](#passing-the-access-token)
2626
- [Token Scopes](#token-scopes)
2727
- [Defining Scopes](#defining-scopes)
28+
- [Default Scope](#default-scope)
2829
- [Assigning Scopes To Tokens](#assigning-scopes-to-tokens)
2930
- [Checking Scopes](#checking-scopes)
3031
- [Consuming Your API With JavaScript](#consuming-your-api-with-javascript)
@@ -654,6 +655,15 @@ You may define your API's scopes using the `Passport::tokensCan` method in the `
654655
'check-status' => 'Check order status',
655656
]);
656657

658+
<a name="default-scope"></a>
659+
### Default Scope
660+
661+
If a client decides to omit the scope the server still choose to set a default scope. You can achieve setting a default scope by using the `setDefaultScope`. Values need to be separated with a space or be passed as an array:
662+
663+
use Laravel\Passport\Passport;
664+
665+
Passport::setDefaultScope('place-orders check-status');
666+
657667
<a name="assigning-scopes-to-tokens"></a>
658668
### Assigning Scopes To Tokens
659669

0 commit comments

Comments
 (0)