Skip to content

Conversation

Copy link

Copilot AI commented Jul 30, 2025

This PR implements comprehensive outbound application management functionality for the Descope Python SDK, achieving feature parity with the Node SDK as requested in issue #11531.

What are Outbound Applications?

Outbound applications are external OAuth/OIDC providers (like Google, Microsoft, Facebook) that Descope connects to as a client. This is the reverse of inbound SSO applications - instead of other apps connecting to Descope for authentication, these are external services that Descope users can authenticate with.

Implementation

Application Management

  • create_application() - Create new outbound applications with full OAuth/OIDC configuration
  • update_application() - Update existing applications
  • delete_application() - Delete applications
  • load_application() - Get single application by ID
  • load_all_applications() - Get all applications

Token Management

  • fetch_outbound_app_user_token() - Fetch user tokens from outbound applications
  • delete_outbound_app_token_by_id() - Delete specific tokens
  • delete_outbound_app_user_tokens() - Delete all user tokens for an app

Usage Example

from descope import DescopeClient

client = DescopeClient(project_id="...", management_key="...")

# Create a Google OAuth integration
app = client.mgmt.outbound_application.create_application(
    name="My Google Integration",
    client_id="google-client-id",
    client_secret="google-client-secret",
    template_id="google",  # Use pre-configured template
    default_scopes=["openid", "profile", "email"],
    pkce=True,
    access_type="offline",
)

# Fetch user tokens from the external provider
token = client.mgmt.outbound_application.fetch_outbound_app_user_token(
    user_id="user-123",
    app_id=app["app"]["id"],
    scopes=["openid", "profile"],
)

Key Features

  • Full OAuth/OIDC Support: Supports all standard OAuth parameters including PKCE, discovery URLs, custom scopes, and access types
  • Template Support: Pre-configured templates for popular providers (Google, Microsoft, etc.)
  • Secure Handling: Client secrets are only included when explicitly provided
  • Comprehensive Testing: 8 new unit tests covering all functionality
  • Documentation: Complete examples in README and working sample script
  • API Consistency: Follows existing SDK patterns and conventions

Files Changed

  • descope/management/common.py - Added 8 new API endpoint paths
  • descope/management/outbound_application.py - New management class (353 lines)
  • descope/mgmt.py - Integrated into MGMT class
  • tests/management/test_outbound_application.py - Comprehensive test suite (431 lines)
  • README.md - Added documentation section with examples
  • samples/management_outbound_application.py - Practical demonstration script

Testing

All 283 tests pass, including 8 comprehensive new tests covering:

  • Application CRUD operations
  • Token management functionality
  • Error handling scenarios
  • API parameter validation

This implementation provides complete feature parity with the Node SDK's outbound application capabilities, enabling Python developers to easily manage OAuth/OIDC integrations with external providers through Descope.

This pull request was created as a result of the following prompt from Copilot chat.

Context

This task implements issue #11531 in the descope/python-sdk repository. The issue requests adding support for managing outbound app tokens and applications using the Python SDK, aligning its capabilities with those of the Node SDK.

Objective

  1. Add functions in the Python SDK to:
    • Fetch outbound app tokens.
    • Manage outbound applications.
  2. Follow the feature parity with the Node SDK's implementation of these functionalities:

Tasks

  1. Implement the required functions in the Python SDK.
  2. Write unit tests for these new functionalities to ensure correctness.
  3. Update relevant documentation to reflect these changes.

Definition of Done

  1. All new functionalities are implemented and tested successfully.
  2. Documentation is updated to guide users on managing outbound app tokens and applications.

💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Copilot AI changed the title [WIP] Add Outbound App Management in Python SDK Add outbound application management support to Python SDK Jul 30, 2025
Copilot AI requested a review from omercnet July 30, 2025 04:28
@github-actions
Copy link

Coverage report

The coverage rate went from 97.65% to 97.69% ⬆️

100% of new lines are covered.

Diff Coverage details (click to unfold)

descope/management/outbound_application.py

100% of new lines are covered (100% of the complete file).

descope/mgmt.py

100% of new lines are covered (100% of the complete file).

descope/management/common.py

100% of new lines are covered (99.53% of the complete file).

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR implements comprehensive outbound application management functionality for the Descope Python SDK, enabling management of external OAuth/OIDC providers (like Google, Microsoft, Facebook) that Descope connects to as a client. This provides feature parity with the Node SDK as requested in issue #11531.

  • Addition of complete outbound application CRUD operations (create, update, delete, load)
  • Implementation of token management functionality for user tokens from external providers
  • Integration of 8 new API endpoints and comprehensive test coverage

Reviewed Changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
descope/management/outbound_application.py New management class implementing all outbound application and token operations
descope/mgmt.py Integration of OutboundApplication class into the main MGMT interface
descope/management/common.py Addition of 8 new API endpoint paths for outbound application management
tests/management/test_outbound_application.py Comprehensive test suite covering all functionality with 8 test methods
samples/management_outbound_application.py Practical demonstration script showing real-world usage patterns
README.md Documentation section with complete API examples and usage patterns

Comment on lines +1340 to +1341
for app in apps:
# Do something
Copy link

Copilot AI Jul 30, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The indentation for this for loop is inconsistent with the rest of the code block. It should be indented at the same level as the previous line to maintain proper Python syntax.

Suggested change
for app in apps:
# Do something
for app in apps:
# Do something

Copilot uses AI. Check for mistakes.
@guyp-descope
Copy link
Contributor

What is this PR? isnt it a dup of what @gaokevin1 does here: https://github.com/descope/python-sdk/pull/621/files ?

@gaokevin1
Copy link
Member

What is this PR? isnt it a dup of what @gaokevin1 does here: https://github.com/descope/python-sdk/pull/621/files ?

Oh wow I didn't see this. I guess so...

@guyp-descope
Copy link
Contributor

Closing this PR as it indeed (sort of) a dup of @gaokevin1 PR #621
but Kevin PR is better and more accurate.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants