Skip to content

Commit 7ae4622

Browse files
Copilotomercnet
andcommitted
Add complete outbound application management functionality
Co-authored-by: omercnet <[email protected]>
1 parent 9d9e64a commit 7ae4622

File tree

5 files changed

+856
-0
lines changed

5 files changed

+856
-0
lines changed

README.md

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,7 @@ These sections show how to use the SDK to perform permission and user management
7373
13. [Manage FGA (Fine-grained Authorization)](#manage-fga-fine-grained-authorization)
7474
14. [Manage Project](#manage-project)
7575
15. [Manage SSO Applications](#manage-sso-applications)
76+
16. [Manage Outbound Applications](#manage-outbound-applications)
7677

7778
If you wish to run any of our code samples and play with them, check out our [Code Examples](#code-examples) section.
7879

@@ -1301,6 +1302,61 @@ apps = apps_resp["apps"]
13011302
# Do something
13021303
```
13031304

1305+
### Manage Outbound Applications
1306+
1307+
You can create, update, delete or load outbound applications, as well as manage user tokens:
1308+
1309+
```python
1310+
# Create OIDC outbound application
1311+
descope_client.mgmt.outbound_application.create_application(
1312+
name="My Google App",
1313+
client_id="google-client-id",
1314+
client_secret="google-client-secret",
1315+
template_id="google", # Use pre-configured Google template
1316+
default_scopes=["openid", "profile", "email"],
1317+
pkce=True,
1318+
access_type="offline",
1319+
)
1320+
1321+
# Update outbound application
1322+
# Update will override all fields as is. Use carefully.
1323+
descope_client.mgmt.outbound_application.update_application(
1324+
id="app-id",
1325+
name="My Updated Google App",
1326+
client_id="updated-client-id",
1327+
description="Updated description",
1328+
default_scopes=["openid", "profile"],
1329+
)
1330+
1331+
# Outbound application deletion cannot be undone. Use carefully.
1332+
descope_client.mgmt.outbound_application.delete_application("app-id")
1333+
1334+
# Load outbound application by id
1335+
app_resp = descope_client.mgmt.outbound_application.load_application("app-id")
1336+
1337+
# Load all outbound applications
1338+
apps_resp = descope_client.mgmt.outbound_application.load_all_applications()
1339+
apps = apps_resp["apps"]
1340+
for app in apps:
1341+
# Do something
1342+
1343+
# Fetch user token for outbound application
1344+
token_resp = descope_client.mgmt.outbound_application.fetch_outbound_app_user_token(
1345+
user_id="user-id",
1346+
app_id="app-id",
1347+
scopes=["openid", "profile"],
1348+
)
1349+
1350+
# Delete specific token by ID
1351+
descope_client.mgmt.outbound_application.delete_outbound_app_token_by_id("token-id")
1352+
1353+
# Delete all user tokens for a specific app
1354+
descope_client.mgmt.outbound_application.delete_outbound_app_user_tokens(
1355+
user_id="user-id",
1356+
app_id="app-id",
1357+
)
1358+
```
1359+
13041360
### Utils for your end to end (e2e) tests and integration tests
13051361

13061362
To ease your e2e tests, we exposed dedicated management methods,

descope/management/common.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -154,6 +154,16 @@ class MgmtV1:
154154
project_import = "/v1/mgmt/project/import"
155155
project_list_projects = "/v1/mgmt/projects/list"
156156

157+
# outbound application
158+
outbound_application_create_path = "/v1/mgmt/outbound/application/create"
159+
outbound_application_update_path = "/v1/mgmt/outbound/application/update"
160+
outbound_application_delete_path = "/v1/mgmt/outbound/application/delete"
161+
outbound_application_load_path = "/v1/mgmt/outbound/application/load"
162+
outbound_application_load_all_path = "/v1/mgmt/outbound/application/all"
163+
outbound_application_fetch_user_token_path = "/v1/mgmt/outbound/application/token/fetch"
164+
outbound_application_delete_token_by_id_path = "/v1/mgmt/outbound/application/token/delete"
165+
outbound_application_delete_user_tokens_path = "/v1/mgmt/outbound/application/user/tokens/delete"
166+
157167

158168
class MgmtSignUpOptions:
159169
def __init__(

0 commit comments

Comments
 (0)