From 1d1162327ee9b20a0ba4a2781f03c7b0dd47c789 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20Guillot?= Date: Tue, 22 Jul 2025 21:07:22 -0700 Subject: [PATCH] feat(integration): use Bearer token authorization instead of cookie for Linkwarden client --- internal/integration/linkwarden/linkwarden.go | 20 ++++--------------- 1 file changed, 4 insertions(+), 16 deletions(-) diff --git a/internal/integration/linkwarden/linkwarden.go b/internal/integration/linkwarden/linkwarden.go index d9585fe5..1416e8bb 100644 --- a/internal/integration/linkwarden/linkwarden.go +++ b/internal/integration/linkwarden/linkwarden.go @@ -35,12 +35,9 @@ func (c *Client) CreateBookmark(entryURL, entryTitle string) error { return fmt.Errorf(`linkwarden: invalid API endpoint: %v`, err) } - requestBody, err := json.Marshal(&linkwardenBookmark{ - Url: entryURL, - Name: entryTitle, - Description: "", - Tags: []string{}, - Collection: map[string]any{}, + requestBody, err := json.Marshal(map[string]string{ + "url": entryURL, + "name": entryTitle, }) if err != nil { @@ -54,8 +51,7 @@ func (c *Client) CreateBookmark(entryURL, entryTitle string) error { request.Header.Set("Content-Type", "application/json") request.Header.Set("User-Agent", "Miniflux/"+version.Version) - request.AddCookie(&http.Cookie{Name: "__Secure-next-auth.session-token", Value: c.apiKey}) - request.AddCookie(&http.Cookie{Name: "next-auth.session-token", Value: c.apiKey}) + request.Header.Set("Authorization", "Bearer "+c.apiKey) httpClient := &http.Client{Timeout: defaultClientTimeout} response, err := httpClient.Do(request) @@ -70,11 +66,3 @@ func (c *Client) CreateBookmark(entryURL, entryTitle string) error { return nil } - -type linkwardenBookmark struct { - Url string `json:"url"` - Name string `json:"name"` - Description string `json:"description"` - Tags []string `json:"tags"` - Collection map[string]any `json:"collection"` -}