-
Notifications
You must be signed in to change notification settings - Fork 6
feat: add OAuth support for regional bots #209
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Co-authored-by: lilyydu <54044854+lilyydu@users.noreply.github.com>
Co-authored-by: lilyydu <54044854+lilyydu@users.noreply.github.com>
|
@copilot A series of updates were made here. Complete the same changes |
Co-authored-by: lilyydu <54044854+lilyydu@users.noreply.github.com>
Completed the refactoring from PR #394. Changes applied in commit 9982511:
The API is now simpler with Warning Firewall rules blocked me from connecting to one or more addresses (expand for details)I tried to connect to the following addresses, but was blocked by firewall rules:
If you need me to access, download, or install something from one of these locations, you can either:
|
Co-authored-by: lilyydu <54044854+lilyydu@users.noreply.github.com>
|
Just as a heads up, I was blocked by some firewall rules while working on your feedback. Expand below for details. Warning Firewall rules blocked me from connecting to one or more addresses (expand for details)I tried to connect to the following addresses, but was blocked by firewall rules:
If you need me to access, download, or install something from one of these locations, you can either:
|
There was a problem hiding this 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 configurable OAuth endpoints to support regional bot deployments in the Microsoft Teams SDK for Python, mirroring the functionality from teams.ts PRs #386 and #394. It enables bots deployed in specific regions (e.g., Europe, Asia) to use regional token endpoints instead of the global endpoint.
Key changes:
- Introduces
ApiClientSettingsdataclass for OAuth endpoint configuration with environment variable support - Updates all API clients to accept and use configurable OAuth URLs
- Adds
api_client_settingsfield toAppOptionsfor easy configuration at the application level
Reviewed Changes
Copilot reviewed 22 out of 22 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| packages/api/src/microsoft/teams/api/clients/api_client_settings.py | New dataclass and utility function for OAuth endpoint configuration |
| packages/api/src/microsoft/teams/api/clients/init.py | Exports new API client settings classes |
| packages/api/src/microsoft/teams/api/clients/api_client.py | Accepts and propagates API client settings to all sub-clients |
| packages/api/src/microsoft/teams/api/clients/bot/client.py | Passes settings to token and sign-in clients |
| packages/api/src/microsoft/teams/api/clients/bot/sign_in_client.py | Uses configurable OAuth URL with endpoint constants |
| packages/api/src/microsoft/teams/api/clients/bot/token_client.py | Accepts and stores API client settings |
| packages/api/src/microsoft/teams/api/clients/user/client.py | Passes settings to token client |
| packages/api/src/microsoft/teams/api/clients/user/token_client.py | Uses configurable OAuth URL with endpoint constants |
| packages/api/src/microsoft/teams/api/clients/conversation/client.py | Propagates settings to activity and member clients |
| packages/api/src/microsoft/teams/api/clients/conversation/activity.py | Accepts API client settings parameter |
| packages/api/src/microsoft/teams/api/clients/conversation/member.py | Accepts API client settings parameter |
| packages/api/src/microsoft/teams/api/clients/team/client.py | Accepts and stores API client settings |
| packages/api/src/microsoft/teams/api/clients/meeting/client.py | Accepts and stores API client settings |
| packages/apps/src/microsoft/teams/apps/options.py | Adds api_client_settings field to app options |
| packages/apps/src/microsoft/teams/apps/app.py | Passes settings to API client and activity processor |
| packages/apps/src/microsoft/teams/apps/app_process.py | Accepts and uses settings when building API clients |
| packages/apps/tests/test_app_process.py | Updates test to pass None for new parameter |
| packages/api/tests/unit/test_user_client.py | Adds 7 new tests for regional endpoint functionality |
| packages/api/tests/unit/test_bot_client.py | Adds 2 new tests for bot regional endpoints |
| tests/graph/src/main.py | Adds example usage in comments |
| tests/graph/README.md | Adds regional bot configuration documentation |
| packages/mcpplugin/src/microsoft/teams/mcpplugin/server_plugin.py | Formatting change to decorator |
packages/api/src/microsoft/teams/api/clients/api_client_settings.py
Outdated
Show resolved
Hide resolved
Co-authored-by: lilyydu <54044854+lilyydu@users.noreply.github.com>
Co-authored-by: lilyydu <54044854+lilyydu@users.noreply.github.com>
Plan: Add OAuth Support for Regional Bots ✅ COMPLETE
This PR implements OAuth support for regional bots in Python, mirroring the TypeScript implementation.
Summary of Changes
API Layer (
packages/api)ApiClientSettings: New dataclass for OAuth endpoint configurationhttps://token.botframework.comhttps://europe.token.botframework.com)OAUTH_URLenvironment variableBaseClient: Now handlesapi_client_settingsfor all subclassesapi_client_settingsparameter to constructormerge_api_client_settingsinternallyApps Layer (
packages/apps)AppOptions.default_connection_name: OAuth connection name (defaults to "graph")AppOptions.api_client_settings: Top-level field for API client configurationOAuthSettings: Simplified API by keeping all config inAppOptionsoptions.oauth.default_connection_nametooptions.default_connection_nameExample Usage
Testing
Latest Changes
api_client_settingshandling toBaseClientfor inheritancemerge_api_client_settingscalls from subclassesmerge_api_client_settingsimportsOriginal prompt
💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.