MCPcopy
hub / github.com/larksuite/cli / loadLoginRequestedScope

Function loadLoginRequestedScope

cmd/auth/login_scope_cache.go:59–73  ·  view source on GitHub ↗

loadLoginRequestedScope loads the cached requested scope string for a device_code. It returns an empty string if no cache entry exists.

(deviceCode string)

Source from the content-addressed store, hash-verified

57// loadLoginRequestedScope loads the cached requested scope string for a device_code.
58// It returns an empty string if no cache entry exists.
59func loadLoginRequestedScope(deviceCode string) (string, error) {
60 data, err := vfs.ReadFile(loginScopeCachePath(deviceCode))
61 if err != nil {
62 if errors.Is(err, os.ErrNotExist) {
63 return "", nil
64 }
65 return "", err
66 }
67 var record loginScopeCacheRecord
68 if err := json.Unmarshal(data, &record); err != nil {
69 _ = vfs.Remove(loginScopeCachePath(deviceCode))
70 return "", err
71 }
72 return record.RequestedScope, nil
73}
74
75// removeLoginRequestedScope deletes the cache entry for a device_code.
76func removeLoginRequestedScope(deviceCode string) error {

Calls 4

ReadFileFunction · 0.92
RemoveFunction · 0.92
loginScopeCachePathFunction · 0.85
IsMethod · 0.80