fix: ignore env vars on auth force#556
Merged
Merged
Conversation
3e4ca97 to
a566376
Compare
a566376 to
ec06859
Compare
ec06859 to
0ec48a5
Compare
0ec48a5 to
b7787ce
Compare
Contributor
There was a problem hiding this comment.
Pull Request Overview
This PR refactors the authentication code to properly ignore environment variables when the --force flag is used, while also fetching new tokens during regular authentication. The changes improve the auth flow by consolidating logic into a new AuthService class and introducing a force flag mechanism.
- Adds a new
AuthServiceclass that centralizes authentication logic - Implements a force flag mechanism via
set_force_flag()to control environment variable usage - Refactors existing auth code to use the new service classes and OIDC utilities
Reviewed Changes
Copilot reviewed 11 out of 12 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
src/uipath/_cli/cli_auth.py |
Simplified to use new AuthService class instead of inline auth logic |
src/uipath/_cli/_auth/_auth_service.py |
New centralized authentication service handling both interactive and client credential flows |
src/uipath/_cli/_auth/_url_utils.py |
Added global force flag mechanism to control environment variable usage |
src/uipath/_cli/_auth/_portal_service.py |
Updated to use new OIDC utilities and improved token refresh logic |
src/uipath/_cli/_auth/_oidc_utils.py |
Refactored functions into OidcUtils class for better organization |
src/uipath/_cli/_auth/_client_credentials.py |
Updated to use base URL parameter and improved error handling |
src/uipath/_cli/_auth/_auth_server.py |
Updated to use new OidcUtils class |
tests/cli/test_*.py |
Updated test patches to use new class structure |
pyproject.toml |
Version bump to 2.1.42 |
Comments suppressed due to low confidence (1)
src/uipath/_cli/_auth/_client_credentials.py:135
- The docstring mentions a
base_urlparameter that doesn't exist in the method signature. Remove this line from the Args section sincebase_urlis accessed viaself._base_url.
def _setup_environment(self, token_data: TokenData):
"""Setup environment variables for client credentials authentication.
Args:
token_data: The token data from authentication
base_url: The base URL for the UiPath instance
"""
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
GabrielVasilescu04
approved these changes
Sep 12, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Development Package