MCPcopy Create free account
hub / github.com/devnullvoid/pvetui / GetAuthToken

Method GetAuthToken

pkg/api/client.go:141–157  ·  view source on GitHub ↗

GetAuthToken returns the authentication token for API requests.

()

Source from the content-addressed store, hash-verified

139
140// GetAuthToken returns the authentication token for API requests.
141func (c *Client) GetAuthToken() string {
142 if c.httpClient.apiToken != "" {
143 return c.httpClient.apiToken
144 }
145
146 // For ticket-based authentication, get the current ticket
147 if c.authManager != nil {
148 ctx := context.Background()
149
150 token, err := c.authManager.GetValidToken(ctx)
151 if err == nil && token != nil {
152 return fmt.Sprintf("PVEAuthCookie=%s", token.Ticket)
153 }
154 }
155
156 return ""
157}
158
159// GetWithCache makes a GET request to the Proxmox API with caching.
160func (c *Client) GetWithCache(path string, result *map[string]interface{}, ttl time.Duration) error {

Callers 2

Calls 1

GetValidTokenMethod · 0.80

Tested by

no test coverage detected