Set Oauth App in uipath orchestrator for github action CICD Pipeline

Hi, I integrate UiPath with GitHub , In GitHub implement the cicd pipeline using yml code and PowerShell, the UiPath operation are implement in PowerShell. Here we facing problem is in our organization they don’t give API access, so i unable to get the UiPath Client ID and Secret ID, so i think we can use OAUTH in orchestrator which is external application. But i have code for direct API access only ,so what are the things I want to change in code and how to create and use the OAuth in orchestrator for this.

Thanks,
Karthik Murugesan

Hi @Karthik_Murugesan

If your organization doesn’t provide API access to UiPath Orchestrator, you can work around this limitation by using OAuth 2.0 authentication with an external application. Here are the steps to integrate UiPath Orchestrator with your GitHub CI/CD pipeline using OAuth 2.0:

  1. Create OAuth 2.0 Application in UiPath Orchestrator:

    • Log in to your UiPath Orchestrator instance.
    • Go to the “Settings” section.
    • Under “Security,” select “External Apps.”
    • Create a new OAuth 2.0 application by providing a name and specifying the redirect URI (the URL to which the OAuth response will be sent after authentication).
    • Note down the Client ID and Client Secret generated for this application.
  2. Update Your PowerShell Script:

    • Modify your PowerShell script to use OAuth 2.0 for authentication instead of the Client ID and Client Secret.
    • You’ll need to use OAuth 2.0 authorization code flow or client credentials flow in your PowerShell script. UiPath Orchestrator supports OAuth 2.0, so you can follow the OAuth 2.0 specifications to authenticate and obtain access tokens.
  3. GitHub CI/CD Pipeline Configuration:

    • In your GitHub CI/CD pipeline, you need to set up a secure way to store and retrieve the OAuth 2.0 credentials (Client ID and Client Secret) for your UiPath Orchestrator application.
    • Use GitHub Secrets or other secure environment variables to store these credentials.
  4. OAuth 2.0 Authentication Flow:

    • In your PowerShell script, you’ll need to perform the OAuth 2.0 authentication flow to obtain an access token from UiPath Orchestrator.
    • This typically involves making HTTP requests to Orchestrator’s OAuth 2.0 endpoints, including the authorization endpoint and token endpoint.
    • Here’s a simplified example of how the OAuth 2.0 flow might look in PowerShell:
      # Step 1: Redirect the user (GitHub CI/CD pipeline) to the Orchestrator authorization endpoint.
      # Step 2: Receive the authorization code from the redirect.
      # Step 3: Exchange the authorization code for an access token using the token endpoint.
      # Step 4: Use the access token to make authenticated API requests to Orchestrator.
      
  5. API Requests:

    • After obtaining an access token, you can use it to make authenticated API requests to UiPath Orchestrator.

Ensure that your PowerShell script handles OAuth 2.0 authentication securely

Hi

Refer this Example here

https://docs.uipath.com/orchestrator/standalone/2022.10/api-guide/using-oauth-for-external-apps

Steps to access external applications

https://docs.uipath.com/orchestrator/standalone/2023.4/user-guide/authorizing-external-applications

Cheers @Karthik_Murugesan