Skip to content

Commit bbabb25

Browse files
committed
Merge requested scopes and defaults scopes correctly on login
1 parent 6a4ce26 commit bbabb25

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

src/auth0_server_python/auth_server/server_client.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@
4040
# Generic type for store options
4141
TStoreOptions = TypeVar('TStoreOptions')
4242
INTERNAL_AUTHORIZE_PARAMS = ["client_id", "redirect_uri", "response_type",
43-
"code_challenge", "code_challenge_method", "state", "nonce"]
43+
"code_challenge", "code_challenge_method", "state", "nonce", "scope"]
4444

4545

4646
class ServerClient(Generic[TStoreOptions]):
@@ -154,11 +154,17 @@ async def start_interactive_login(
154154
state = PKCE.generate_random_string(32)
155155
auth_params["state"] = state
156156

157+
#merge any requested scope with defaults
158+
requested_scope = options.authorization_params.get("scope", None) if options.authorization_params else None
159+
audience = auth_params.get("audience", None)
160+
merged_scope = self._merge_scope_with_defaults(requested_scope, audience)
161+
auth_params["scope"] = merged_scope
162+
157163
# Build the transaction data to store
158164
transaction_data = TransactionData(
159165
code_verifier=code_verifier,
160166
app_state=options.app_state,
161-
audience=auth_params.get("audience", None),
167+
audience=audience,
162168
)
163169

164170
# Store the transaction data

0 commit comments

Comments
 (0)