Skip to content

fix: ignore env vars on auth force#556

Merged
radu-mocanu merged 1 commit into
mainfrom
fix/cli-auth
Sep 12, 2025
Merged

fix: ignore env vars on auth force#556
radu-mocanu merged 1 commit into
mainfrom
fix/cli-auth

Conversation

@radu-mocanu

@radu-mocanu radu-mocanu commented Sep 9, 2025

Copy link
Copy Markdown
Collaborator
  • ignore env vars on auth force
  • fetch new token on regular auth
  • refactor auth code

Development Package

  • Add this package as a dependency in your pyproject.toml:
[project]
dependencies = [
  # Exact version:
  "uipath==2.1.42.dev1005561018",

  # Any version from PR
  "uipath>=2.1.42.dev1005560000,<2.1.42.dev1005570000"
]

[[tool.uv.index]]
name = "testpypi"
url = "https://test.pypi.org/simple/"
publish-url = "https://test.pypi.org/legacy/"
explicit = true

[tool.uv.sources]
uipath = { index = "testpypi" }

Comment thread tests/cli/test_auth.py Dismissed
@radu-mocanu radu-mocanu self-assigned this Sep 9, 2025
@radu-mocanu radu-mocanu added the build:dev Create a dev build from the pr label Sep 9, 2025

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

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 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 AuthService class 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_url parameter that doesn't exist in the method signature. Remove this line from the Args section since base_url is accessed via self._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.

@radu-mocanu radu-mocanu merged commit ba89af2 into main Sep 12, 2025
16 checks passed
@radu-mocanu radu-mocanu deleted the fix/cli-auth branch September 12, 2025 07:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

build:dev Create a dev build from the pr

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants