Skip to content

client: never create clients with nil cookie jars#52

Merged
bradtgmurray merged 2 commits intomainfrom
feb11-nil-cookie-fix-round-2
Feb 11, 2026
Merged

client: never create clients with nil cookie jars#52
bradtgmurray merged 2 commits intomainfrom
feb11-nil-cookie-fix-round-2

Conversation

@bradtgmurray
Copy link
Contributor

@bradtgmurray bradtgmurray commented Feb 11, 2026

With #51, we worked around a crash at startup by handling our cookie jar being nil, but that just caused explosions down the line when we tried to do other operations such as logging out which would attempt to use our cookies (c.getCSRFToken refers to c.jar which is nil).

func (c *Client) Logout(ctx context.Context) error {
_, err := c.newAuthedRequest(http.MethodGet, linkedInLogoutURL).
WithQueryParam("csrfToken", c.getCSRFToken()).
Do(ctx, nil)
return err
}

Just make sure our linkedingo.Client is never created with nil cookies. This also makes the previous change unecessary. Pushed IsLoggedIn down to the linkedingo client to make things more similar to our other bridges instead of checking the origina userLogin struct. Also, skip logging out if we're not logged in, there's no credentials available to make the logout request with.

@bradtgmurray bradtgmurray changed the title Try again to fix handling nil cookies in logged out clients client: never create clients with nil cookie jars Feb 11, 2026
@bradtgmurray bradtgmurray merged commit c93b2c0 into main Feb 11, 2026
15 checks passed
@bradtgmurray bradtgmurray deleted the feb11-nil-cookie-fix-round-2 branch February 11, 2026 23:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

1 participant