Could not fetch access token error when using CLI

How to resolve "could not fetch access token” error when using CLI?

Issue Description

While using CLI from cmd/powershell “could not fetch access token” error is thrown.

Example of command while using Pack task:

.\uipcli.exe package pack "C:\Users\john.doe@domain.com\xxxxxx\project.json" -o "C:\Users\john.doe@domain.com\Test"  --libraryOrchestratorUrl “https://cloud.uipath.com/” --libraryOrchestratorAccountForApp "AccountName" --libraryOrchestratorTenant "TenantName" --libraryOrchestratorApplicationId "xxxxxxxxxxxxx" --libraryOrchestratorApplicationSecret "(c*T#$uri)ln9rsb" --libraryOrchestratorApplicationScope "OR.Folders OR.BackgroundTasks OR.TestSets OR.TestSetExecutions OR.TestSetSchedules OR.Settings.Read OR.Robots.Read OR.Machines.Read OR.Execution OR.Assets OR.Users.Read OR.Jobs OR.Monitoring"

Error Screenshot:

NonWorkingCommand2.png

Resolution

Use client secret inside the command that does not contain the $ character.

Example:

.\uipcli.exe package pack "C:\Users\john.doe@domain.com\xxxxxx\project.json" -o "C:\Users\john.doe@domain.com\Test" --libraryOrchestratorUrl “https://cloud.uipath.com/” --libraryOrchestratorAccountForApp "AccountName" --libraryOrchestratorTenant "TenantName" --libraryOrchestratorApplicationId "xxxxxxxxxxxxx" --libraryOrchestratorApplicationSecret "@~l6Y(^iBv85khK~" --libraryOrchestratorApplicationScope "OR.Folders OR.BackgroundTasks OR.TestSets OR.TestSetExecutions OR.TestSetSchedules OR.Settings.Read OR.Robots.Read OR.Machines.Read OR.Execution OR.Assets OR.Users.Read OR.Jobs OR.Monitoring"

Root Cause:
In Powershell, the dollar sign $ is used to denote variables and hence it cannot be used in Client Secret.

image.png