From 62d92fa5ef26db38390239003bc7a45145bc77f3 Mon Sep 17 00:00:00 2001 From: Joao-Pedro-P-Holanda Date: Thu, 13 Feb 2025 18:54:19 -0300 Subject: [PATCH] fix: correcting Security scopes when string is given creating a list explicitly with scopes value when scopes receives a string --- fastapi/params.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/fastapi/params.py b/fastapi/params.py index 8f5601dd3..2740b5824 100644 --- a/fastapi/params.py +++ b/fastapi/params.py @@ -783,4 +783,7 @@ class Security(Depends): use_cache: bool = True, ): super().__init__(dependency=dependency, use_cache=use_cache) - self.scopes = scopes or [] + if isinstance(scopes, str): + self.scopes = [scopes] + else: + self.scopes = scopes or []