From abf9fdf86ef91c435352f6fd9abe03708fe8ed02 Mon Sep 17 00:00:00 2001 From: Donato Mastronardi Date: Sat, 7 Oct 2023 12:13:05 +0200 Subject: [PATCH 1/2] Added simple explaination for custom scopes --- docs/controlling-token-scopes.md | 35 ++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) diff --git a/docs/controlling-token-scopes.md b/docs/controlling-token-scopes.md index d4e6274a..19221e39 100644 --- a/docs/controlling-token-scopes.md +++ b/docs/controlling-token-scopes.md @@ -33,3 +33,38 @@ App\EventListener\ScopeResolveListener: tags: - { name: kernel.event_listener, event: trikoder.oauth2.scope_resolve, method: onScopeResolve } ``` + +## Work with refresh token +The scopes created in this way will not be recognized by the library. +In order to append new scopes, you need to override the service `Trikoder\Bundle\OAuth2Bundle\Manager\ScopeManagerInterface`. +Here is an example: +```yaml +# services.yaml +Trikoder\Bundle\OAuth2Bundle\Manager\ScopeManagerInterface: + alias: Path\To\Custom\Manager +``` +in the manager you can implement the business logic needed to validate the tokens you issued in the scope resolve listener +```php + Date: Sat, 7 Oct 2023 12:16:36 +0200 Subject: [PATCH 2/2] Added description of the problem solved --- docs/controlling-token-scopes.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/controlling-token-scopes.md b/docs/controlling-token-scopes.md index 19221e39..014b6e7c 100644 --- a/docs/controlling-token-scopes.md +++ b/docs/controlling-token-scopes.md @@ -35,7 +35,7 @@ App\EventListener\ScopeResolveListener: ``` ## Work with refresh token -The scopes created in this way will not be recognized by the library. +The scopes created in this way will not be recognized by the library when trying to login using the `refresh_token` grant method. In order to append new scopes, you need to override the service `Trikoder\Bundle\OAuth2Bundle\Manager\ScopeManagerInterface`. Here is an example: ```yaml