Skip to content

Commit 52504fe

Browse files
committed
SDK-8833 Moved invitation param to inside authorization params
1 parent cff2355 commit 52504fe

3 files changed

Lines changed: 5 additions & 38 deletions

File tree

src/auth0_server_python/auth_server/server_client.py

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@
7575
# dynamically from the resolved domain at login time.
7676
INTERNAL_AUTHORIZE_PARAMS = ["client_id", "response_type",
7777
"code_challenge", "code_challenge_method", "state", "nonce", "scope",
78-
"organization", "invitation"]
78+
"organization"]
7979

8080
_ORG_ACCESS_DENIED_FRAGMENTS = (
8181
"is not part of the",
@@ -583,10 +583,6 @@ async def start_interactive_login(
583583
if resolved_org:
584584
auth_params["organization"] = resolved_org
585585

586-
# Invitation is forwarded to /authorize but not stored for callback validation.
587-
if options.invitation:
588-
auth_params["invitation"] = options.invitation
589-
590586
# Build the transaction data to store with domain
591587
transaction_data = TransactionData(
592588
code_verifier=code_verifier,

src/auth0_server_python/auth_types/__init__.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,6 @@ class StartInteractiveLoginOptions(BaseModel):
151151
app_state: Optional[Any] = None
152152
authorization_params: Optional[dict[str, Any]] = None
153153
organization: Optional[str] = None
154-
invitation: Optional[str] = None
155154

156155

157156
class LogoutOptions(BaseModel):

src/auth0_server_python/tests/test_server_client.py

Lines changed: 4 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -4989,7 +4989,7 @@ async def test_invitation_and_org_forwarded_to_authorize(mocker):
49894989
url = await client.start_interactive_login(
49904990
StartInteractiveLoginOptions(
49914991
organization="org_abc123",
4992-
invitation="inv_token_xyz",
4992+
authorization_params={"invitation": "inv_token_xyz"},
49934993
)
49944994
)
49954995

@@ -5001,7 +5001,6 @@ async def test_invitation_and_org_forwarded_to_authorize(mocker):
50015001
assert stored.organization == "org_abc123"
50025002

50035003

5004-
50055004
@pytest.mark.asyncio
50065005
async def test_invitation_without_org_forwarded_to_authorize(mocker):
50075006
"""invitation alone appears in the URL; no organization param."""
@@ -5021,41 +5020,14 @@ async def test_invitation_without_org_forwarded_to_authorize(mocker):
50215020
"authorization_endpoint": "https://tenant.auth0.com/authorize",
50225021
})
50235022

5024-
url = await client.start_interactive_login(
5025-
StartInteractiveLoginOptions(invitation="inv_token_xyz")
5026-
)
5027-
5028-
assert "invitation=inv_token_xyz" in url
5029-
assert "organization=" not in url
5030-
5031-
5032-
@pytest.mark.asyncio
5033-
async def test_invitation_via_authorization_params_dict_is_ignored(mocker):
5034-
"""invitation passed via authorization_params dict is stripped; typed field is the only path."""
5035-
mock_tx_store = AsyncMock()
5036-
mock_state_store = AsyncMock()
5037-
client = ServerClient(
5038-
domain="tenant.auth0.com",
5039-
client_id="test_client",
5040-
client_secret="test_secret",
5041-
redirect_uri="https://app.example.com/callback",
5042-
transaction_store=mock_tx_store,
5043-
state_store=mock_state_store,
5044-
secret="test_secret_key_32_chars_long!!",
5045-
)
5046-
mocker.patch.object(client, "_get_oidc_metadata_cached", return_value={
5047-
"issuer": "https://tenant.auth0.com/",
5048-
"authorization_endpoint": "https://tenant.auth0.com/authorize",
5049-
})
5050-
50515023
url = await client.start_interactive_login(
50525024
StartInteractiveLoginOptions(
5053-
authorization_params={"invitation": "inv_via_dict"},
5025+
authorization_params={"invitation": "inv_token_xyz"}
50545026
)
50555027
)
50565028

5057-
parsed = parse_qs(urlparse(url).query)
5058-
assert "invitation" not in parsed
5029+
assert "invitation=inv_token_xyz" in url
5030+
assert "organization=" not in url
50595031

50605032

50615033
@pytest.mark.asyncio

0 commit comments

Comments
 (0)