Skip to content

Conversation

@dredozubov
Copy link

What kind of change does this PR introduce?

Bug fix

Why was this change needed?

LinkedIn integration fails during OAuth callback because Postiz cannot download the user's profile picture from LinkedIn's CDN. The CDN returns HTTP 403 (Forbidden), causing the entire integration to fail.

Root cause: LocalStorage.uploadSimple() performs a bare axios.get(url) with no headers. LinkedIn's CDN blocks this request because:

  • No User-Agent header (axios default is axios/x.x.x)
  • No Authorization header (Bearer token not passed)
  • Server-to-server request detected (non-browser fingerprint)

Related issue: Fixes #972

Solution

Two-part fix:

  1. Pass Bearer token: Add optional headers parameter to uploadSimple() and pass the Authorization header when downloading profile pictures
  2. Graceful fallback: Wrap picture upload in try-catch so integration succeeds even if picture download fails (user gets placeholder avatar instead)

Changes

  • upload.interface.ts: Added UploadSimpleOptions interface with optional headers
  • local.storage.ts: Added browser-like User-Agent and accepts optional headers
  • cloudflare.storage.ts: Same changes for Cloudflare storage provider
  • integration.service.ts: Pass Bearer token, wrap in try-catch for graceful fallback

Testing

Tested in combination with #1134 using a deployment branch on my fork. Successfully added LinkedIn Channel to self-hosted Postiz instance.

Checklist:

  • I have read the CONTRIBUTING guide.
  • I checked that there were not similar issues or PRs already open for this.
  • This PR fixes just ONE issue (do not include multiple issues or types of change in the same PR)

   Changes:
   - Add optional headers parameter to uploadSimple interface
   - Pass Authorization bearer token when downloading profile pictures
   - Add browser-like User-Agent header for CDN compatibility
   - Wrap picture upload in try-catch for graceful fallback

   If picture download fails, integration now succeeds with a placeholder
   avatar instead of failing completely.

   Fixes gitroomhq#972
@vercel
Copy link

vercel bot commented Dec 25, 2025

@dredozubov is attempting to deploy a commit to the Listinai Team on Vercel.

A member of the Team first needs to authorize it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

LinkedIn integration fails with 403 error when fetching profile picture

1 participant