How To Clear Cookies In UiPath Assistant App?

How can the cookies be cleared in the UiPath Assistant App?

Issue Description: Users or administrators may need to clear cookies from the UiPath Assistant App for various reasons like troubleshooting or user privacy. The traditional method of clearing cookies within the app requires it to run in debug mode using the --dbg parameter. Then, one would have to clear them in developer tools. This process can be cumbersome, especially when trying to implement it on a larger scale.


Root Cause: Clearing cookies within the UiPath Assistant App traditionally requires running the app in debug mode (--dbg) and then manually clearing them via developer tools. This process is not straightforward, especially for large-scale implementations or for users unfamiliar with developer tools. The provided script offers a more scalable and user-friendly solution for this task.


Resolution:

Approach #1: Manual Removal

  1. Navigate to the folder: %USERPROFILE%\AppData\Roaming\UiPath Assistant\Network
  2. Identify the files named Cookies and Cookies-Journal.
  3. Rename both files by appending .bak to their names. For example, rename Cookies to Cookies.bak and Cookies-Journal to Cookies-Journal.bak.


Approach #2: Using the Script

A PowerShell script can be employed to automate the cookie clearing process:

# Sets the directory path of the logged in user
$dirPath = "$env:USERPROFILE\AppData\Roaming\UiPath Assistant\Network"

# Rename the cookie files if they exist
$filesToRename = @('Cookies', 'Cookies-Journal')
foreach ($file in $filesToRename) {
  $filePath = Join-Path -Path $dirPath -ChildPath $file
  if (Test-Path $filePath) {
    Rename-Item -Path $filePath -NewName "$file.bak"
    Write-Output "Renamed $file to $file.bak"
  } else {
    Write-Output "$file not found"
  }
}

**Save this script into a text editor of your choice and with the '.ps1' extension