fix credential helper

This commit is contained in:
Evan Jarrett
2025-10-12 20:15:19 -05:00
parent 6edc22cfcc
commit 75253e256d

View File

@@ -541,12 +541,16 @@ func isTerminal(f *os.File) bool {
// validateCredentials checks if the credentials are still valid by making a test request
func validateCredentials(appViewURL, handle, deviceSecret string) bool {
// Make a request to /v2/ which requires authentication
// Call /auth/token to validate device secret and get JWT
// This is the proper way to validate credentials - /v2/ requires JWT, not Basic Auth
client := &http.Client{
Timeout: 5 * time.Second,
}
req, err := http.NewRequest("GET", appViewURL+"/v2/", nil)
// Build /auth/token URL with minimal scope (just access to /v2/)
tokenURL := appViewURL + "/auth/token?service=" + appViewURL
req, err := http.NewRequest("GET", tokenURL, nil)
if err != nil {
return false
}