Skip to content

Commit 63fb060

Browse files
feat: Bind managed auth submissions to interactions
Stainless-Generated-From: 53fd8808daedcb207b0d72e49a72d5deb67817f4
1 parent 3522fcb commit 63fb060

5 files changed

Lines changed: 32 additions & 0 deletions

File tree

src/kernel/resources/auth/connections.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -530,6 +530,7 @@ def submit(
530530
*,
531531
field_values: Dict[str, str] | Omit = omit,
532532
fields: Dict[str, str] | Omit = omit,
533+
interaction_id: str | Omit = omit,
533534
mfa_option_id: str | Omit = omit,
534535
selected_choice_id: str | Omit = omit,
535536
sign_in_option_id: str | Omit = omit,
@@ -552,6 +553,9 @@ def submit(
552553
553554
fields: Map of field name to value
554555
556+
interaction_id: Opaque interaction ID returned with canonical fields and choices. Required for
557+
canonical submissions.
558+
555559
mfa_option_id: The MFA method type to select (when mfa_options were returned)
556560
557561
selected_choice_id: Canonical choice ID selected by the user.
@@ -580,6 +584,7 @@ def submit(
580584
{
581585
"field_values": field_values,
582586
"fields": fields,
587+
"interaction_id": interaction_id,
583588
"mfa_option_id": mfa_option_id,
584589
"selected_choice_id": selected_choice_id,
585590
"sign_in_option_id": sign_in_option_id,
@@ -1143,6 +1148,7 @@ async def submit(
11431148
*,
11441149
field_values: Dict[str, str] | Omit = omit,
11451150
fields: Dict[str, str] | Omit = omit,
1151+
interaction_id: str | Omit = omit,
11461152
mfa_option_id: str | Omit = omit,
11471153
selected_choice_id: str | Omit = omit,
11481154
sign_in_option_id: str | Omit = omit,
@@ -1165,6 +1171,9 @@ async def submit(
11651171
11661172
fields: Map of field name to value
11671173
1174+
interaction_id: Opaque interaction ID returned with canonical fields and choices. Required for
1175+
canonical submissions.
1176+
11681177
mfa_option_id: The MFA method type to select (when mfa_options were returned)
11691178
11701179
selected_choice_id: Canonical choice ID selected by the user.
@@ -1193,6 +1202,7 @@ async def submit(
11931202
{
11941203
"field_values": field_values,
11951204
"fields": fields,
1205+
"interaction_id": interaction_id,
11961206
"mfa_option_id": mfa_option_id,
11971207
"selected_choice_id": selected_choice_id,
11981208
"sign_in_option_id": sign_in_option_id,

src/kernel/types/auth/connection_follow_response.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -221,6 +221,13 @@ class ManagedAuthStateEvent(BaseModel):
221221
hosted_url: Optional[str] = None
222222
"""URL to redirect user to for hosted login."""
223223

224+
interaction_id: Optional[str] = None
225+
"""Opaque identifier for the current canonical interaction.
226+
227+
Required when submitting fields or choices and changes for each new actionable
228+
pause.
229+
"""
230+
224231
live_view_url: Optional[str] = None
225232
"""Browser live view URL for debugging."""
226233

src/kernel/types/auth/connection_submit_params.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,12 @@ class ConnectionSubmitParams(TypedDict, total=False):
1515
fields: Dict[str, str]
1616
"""Map of field name to value"""
1717

18+
interaction_id: str
19+
"""Opaque interaction ID returned with canonical fields and choices.
20+
21+
Required for canonical submissions.
22+
"""
23+
1824
mfa_option_id: str
1925
"""The MFA method type to select (when mfa_options were returned)"""
2026

src/kernel/types/auth/managed_auth.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -501,6 +501,13 @@ class ManagedAuth(BaseModel):
501501
hosted_url: Optional[str] = None
502502
"""URL to redirect user to for hosted login (present when flow in progress)"""
503503

504+
interaction_id: Optional[str] = None
505+
"""Opaque identifier for the current canonical interaction.
506+
507+
Required when submitting fields or choices and changes for each new actionable
508+
pause.
509+
"""
510+
504511
last_auth_at: Optional[datetime] = None
505512
"""Deprecated alias for `last_auth_check_at`.
506513

tests/api_resources/auth/test_connections.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -556,6 +556,7 @@ def test_method_submit_with_all_params(self, client: Kernel) -> None:
556556
"email": "user@example.com",
557557
"password": "secret",
558558
},
559+
interaction_id="mai_abc123xyz",
559560
mfa_option_id="sms",
560561
selected_choice_id="google",
561562
sign_in_option_id="work-account",
@@ -1190,6 +1191,7 @@ async def test_method_submit_with_all_params(self, async_client: AsyncKernel) ->
11901191
"email": "user@example.com",
11911192
"password": "secret",
11921193
},
1194+
interaction_id="mai_abc123xyz",
11931195
mfa_option_id="sms",
11941196
selected_choice_id="google",
11951197
sign_in_option_id="work-account",

0 commit comments

Comments
 (0)