mirror of
https://tangled.org/evan.jarrett.net/at-container-registry
synced 2026-06-06 15:22:34 +00:00
fix credential helper
This commit is contained in:
@@ -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
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user