-
Notifications
You must be signed in to change notification settings - Fork 177
Add CLI interactive browser login #4857
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
Add CLI interactive browser login #4857
Conversation
Unit Test Results0 tests 0 ✅ 0s ⏱️ Results for commit 0d5f17a. ♻️ This comment has been updated with latest results. |
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 adds an interactive browser-based authentication method to the TRE CLI, addressing scenarios where device code flow is blocked by organizational policies. The implementation follows the existing patterns established by the device-code and client-credentials login methods, with the addition of automatic TRE URL discovery from saved configuration or deployment outputs.
Changes:
- Added
InteractiveApiClientclass that uses MSAL's interactive browser authentication with silent token refresh from cache - Added
tre login interactivecommand with auto-discovery of TRE URL from~/.config/tre/environment.jsonorcore/tre_output.json - Updated CLI documentation to include the new interactive login method as the recommended approach for developers
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 4 comments.
| File | Description |
|---|---|
| docs/tre-developers/CLI.md | Documents the new interactive browser flow login method with usage examples and auto-discovery behavior |
| cli/tre/commands/login.py | Implements the login_interactive command with base URL auto-discovery and token caching |
| cli/tre/api_client.py | Adds InteractiveApiClient class with support for silent token refresh and interactive browser authentication |
| CHANGELOG.md | Records the enhancement with proper issue reference |
Comments suppressed due to low confidence (1)
cli/tre/api_client.py:131
- Overridden method signature does not match call, where it is passed too many arguments. Overriding method method ClientCredentialsApiClient.get_auth_token matches the call.
Overridden method signature does not match call, where it is passed too many arguments. Overriding method method DeviceCodeApiClient.get_auth_token matches the call.
Overridden method signature does not match call, where it is passed too many arguments. Overriding method method InteractiveApiClient.get_auth_token matches the call.
Overridden method signature does not match call, where it is passed too many arguments. Overriding method method ClientCredentialsApiClient.get_auth_token matches the call.
Overridden method signature does not match call, where it is passed too many arguments. Overriding method method DeviceCodeApiClient.get_auth_token matches the call.
Overridden method signature does not match call, where it is passed too many arguments. Overriding method method InteractiveApiClient.get_auth_token matches the call.
def get_auth_token() -> str:
…s, fix error message variable
JC-wk
left a comment
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.
LGTM
|
/test Checking CI hasn't been broken. |
|
🤖 pr-bot 🤖 🏃 Running tests: https://github.com/microsoft/AzureTRE/actions/runs/21829999074 (with refid (in response to this comment from @marrobi) |
Fixes #4856
This PR adds an interactive browser login method to the TRE CLI for easier authentication.
Changes
InteractiveApiClientclass to support browser-based MSAL authentication with token cachingtre login interactivecommand that auto-discovers TRE URL from:~/.config/tre/environment.json)core/tre_output.json)Usage