Skip to content

Commit 8367837

Browse files
Henry Chanhenrylamchan
authored andcommitted
Support promoting Draft Connections in SSO Module
1 parent 10f2d71 commit 8367837

File tree

1 file changed

+18
-3
lines changed

1 file changed

+18
-3
lines changed

workos/sso.py

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
from workos.utils.validation import SSO_MODULE, validate_settings
1111

1212
AUTHORIZATION_PATH = "sso/authorize"
13+
PROMOTE_DRAFT_CONNECTION_PATH = "draft_connections/convert"
1314
TOKEN_PATH = "sso/token"
1415

1516
OAUTH_GRANT_TYPE = "authorization_code"
@@ -84,7 +85,7 @@ def get_profile(self, code):
8485
code (str): Code returned by WorkOS on completion of OAuth 2.0 workflow
8586
8687
Returns:
87-
WorkOSProfile - WorkOSProfile object representing the User
88+
WorkOSProfile: WorkOSProfile object representing the User
8889
"""
8990
params = {
9091
"client_id": workos.project_id,
@@ -99,7 +100,7 @@ def get_profile(self, code):
99100

100101
return WorkOSProfile.construct_from_response(response)
101102

102-
def promote_draft_connection(self):
103+
def promote_draft_connection(self, token):
103104
"""Promote a Draft Connection
104105
105106
Promotes a Draft Connection created through the IdP Link embed. A Draft Connection that has
@@ -108,5 +109,19 @@ def promote_draft_connection(self):
108109
Args:
109110
token (str): The token supplied via the response when a draft connection is created via
110111
the Idp Link embed
112+
113+
Returns:
114+
bool: True if a Draft Connection has been successfully promoted
111115
"""
112-
pass
116+
params = {
117+
"id": token,
118+
}
119+
120+
self.request_helper.request(
121+
PROMOTE_DRAFT_CONNECTION_PATH,
122+
method=REQUEST_METHOD_POST,
123+
params=params,
124+
token=workos.api_key,
125+
)
126+
127+
return True

0 commit comments

Comments
 (0)