first try at auth before swtiching

This commit is contained in:
2025-08-27 18:01:03 -07:00
parent f4b9f350ae
commit dc5bfcb281
8 changed files with 728 additions and 106 deletions

View File

@@ -2,25 +2,25 @@ package auth
import (
"net/http"
"net/http/cookiejar"
"time"
)
// AuthClient handles authentication with Garmin Connect
// AuthClient struct handles authentication
type AuthClient struct {
BaseURL string
LoginPath string
TokenURL string
Client *http.Client
Client *http.Client
TokenURL string
}
// NewAuthClient creates a new authentication client
// NewAuthClient creates a new authentication client with cookie persistence
func NewAuthClient() *AuthClient {
jar, _ := cookiejar.New(nil)
client := &http.Client{
Jar: jar,
Timeout: 30 * time.Second,
}
return &AuthClient{
BaseURL: "https://connect.garmin.com",
LoginPath: "/signin",
TokenURL: "https://connect.garmin.com/oauth/token",
Client: &http.Client{
Timeout: 30 * time.Second,
},
Client: client,
TokenURL: "https://connectapi.garmin.com/oauth-service/oauth/exchange/user/2.0",
}
}