Skip to content

Commit e7c65d1

Browse files
committed
Add some doc comments
1 parent c62cdc3 commit e7c65d1

File tree

1 file changed

+28
-1
lines changed

1 file changed

+28
-1
lines changed

src/auth0_server_python/auth_server/server_client.py

Lines changed: 28 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1289,6 +1289,19 @@ async def start_connect_account(
12891289
options: ConnectAccountOptions,
12901290
store_options: dict = None
12911291
) -> str:
1292+
"""
1293+
Initiates the connect account flow for linking a third-party account to the user's profile.
1294+
1295+
This method generates PKCE parameters, creates a transaction and calls the My Account API
1296+
to create a connect account request, returning /connect url containing a ticket.
1297+
1298+
Args:
1299+
options: Options for retrieving an access token for a connection.
1300+
store_options: Optional options used to pass to the Transaction and State Store.
1301+
1302+
Returns:
1303+
The a connect URL containing a ticket to redirect the user to.
1304+
"""
12921305
# Get effective authorization params (merge defaults with provided ones)
12931306
auth_params = dict(self._default_authorization_params)
12941307
if options.authorization_params:
@@ -1307,7 +1320,6 @@ async def start_connect_account(
13071320
code_verifier = PKCE.generate_code_verifier()
13081321
code_challenge = PKCE.generate_code_challenge(code_verifier)
13091322

1310-
# State parameter to prevent CSRF
13111323
state = PKCE.generate_random_string(32)
13121324

13131325
connect_request = ConnectAccountRequest(
@@ -1351,6 +1363,21 @@ async def complete_connect_account(
13511363
state: str,
13521364
store_options: dict = None
13531365
) -> CompleteConnectAccountResponse:
1366+
"""
1367+
Handles the redirect callback to complete the connect account flow for linking a third-party
1368+
account to the user's profile.
1369+
1370+
This works similiar to the redirect from the login flow except it verifies the `connect_code`
1371+
with the My Account API rather than the `code` with the Authorization Server.
1372+
1373+
Args:
1374+
connect_code: The connect code returned from the redirect.
1375+
state: The state parameter persisted from the initial connect account request.
1376+
store_options: Optional options used to pass to the Transaction and State Store.
1377+
1378+
Returns:
1379+
A response from the connect account flow.
1380+
"""
13541381
# Retrieve the transaction data using the state
13551382
transaction_identifier = f"{self._transaction_identifier}:{state}"
13561383
transaction_data = await self._transaction_store.get(transaction_identifier, options=store_options)

0 commit comments

Comments
 (0)