• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

UiPath / uipathcli / 13949178945

19 Mar 2025 02:33PM UTC coverage: 90.47% (-0.001%) from 90.471%
13949178945

Pull #168

github

thschmitt
Add command to clear auth token cache

The uipathcli caches temporary access tokens for 1 hour during which
they are valid. Only after the auth token expires a new token is
retrieved from the identity server.

Due to the caching of the access token, adding or removing scopes will
not take effect immediately. It takes up to 1 hour until the updated
scopes will be used.

Added command to clear cache so that the next command will retrieve a
new auth token:

```bash
uipath config cache clear

Cache has been successfully cleared
```

Issue: https://github.com/UiPath/uipathcli/issues/160
Pull Request #168: Add command to clear auth token cache

37 of 41 new or added lines in 2 files covered. (90.24%)

5933 of 6558 relevant lines covered (90.47%)

1.01 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

75.0
/commandline/cache_clear_command_handler.go
1
package commandline
2

3
import (
4
        "fmt"
5
        "io"
6
        "os"
7

8
        "github.com/UiPath/uipathcli/utils/directories"
9
)
10

11
// cacheClearCommandHandler implements command to clear auth token cache
12
type cacheClearCommandHandler struct {
13
        StdOut io.Writer
14
}
15

16
func (h cacheClearCommandHandler) Clear() error {
1✔
17
        cacheDirectory, err := directories.Cache()
1✔
18
        if err != nil {
1✔
NEW
19
                return err
×
NEW
20
        }
×
21
        err = os.RemoveAll(cacheDirectory)
1✔
22
        if err != nil {
1✔
NEW
23
                return fmt.Errorf("Could not clear cache: %v", err)
×
NEW
24
        }
×
25
        fmt.Fprintln(h.StdOut, "Cache has been successfully cleared")
1✔
26
        return nil
1✔
27
}
28

29
func newCacheClearCommandHandler(stdOut io.Writer) *cacheClearCommandHandler {
1✔
30
        return &cacheClearCommandHandler{
1✔
31
                StdOut: stdOut,
1✔
32
        }
1✔
33
}
1✔
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc