trypost/app/Http/Controllers/Auth
Falconiere Barbosa 410eb9612e fix(linkedin): drop deprecated r_basicprofile from default scopes
Make r_basicprofile opt-in via LINKEDIN_EXTRA_SCOPES so self-hosted users
unblock by default and ops with legacy/enterprise products keep working.

Why
---
LinkedIn rejects OAuth authorize requests with a generic "Bummer,
something went wrong" page when an app asks for a scope it can't grant.
`r_basicprofile` is a legacy scope deprecated in 2018; new LinkedIn dev
apps don't have it, so every self-hosted user hits the rejection
immediately on `/connect/linkedin`.

The two products LinkedIn actually grants to standard apps today are:

- Sign In with LinkedIn using OpenID Connect → `openid profile email`
- Share on LinkedIn                          → `w_member_social`

That set is enough for the connect flow. The only piece of data
`r_basicprofile` was buying us is `/v2/me`'s `vanityName` (pretty
`linkedin.com/in/<slug>`). `fetchVanityName()` already handles HTTP
failure gracefully (returns null), and the only downstream consumer —
`LinkedInPagePublisher`'s post-URL builder — already falls back to a
numeric `linkedin.com/feed/update/<id>` URL when `$account->username`
is null.

Backward compatibility
----------------------
Ops with legacy or enterprise LinkedIn products approved on their dev
app (so they DO have `r_basicprofile`) can opt back in via env:

    LINKEDIN_EXTRA_SCOPES=r_basicprofile

`LinkedInController::resolveScopes()` merges this comma-separated list
into the default scope array. The connect flow's `Socialite::scopes()`
call then includes the legacy scope, preserving the pre-PR behaviour
end-to-end (including `vanityName` lookup).

Net effect for users without `r_basicprofile`:
- Connect flow works (was previously rejected by LinkedIn).
- Posts publish exactly the same way.
- Generated post URLs use the numeric form instead of the vanity slug.

Tests
-----
- `linkedin connect requests the default scope set when LINKEDIN_EXTRA_SCOPES is unset`
- `linkedin connect appends LINKEDIN_EXTRA_SCOPES to the default scope set`
- Existing `splits comma-separated approvedScopes` fixture updated to
  match the new default set.
2026-06-10 13:51:07 -03:00
..
Concerns feat: capture signup UTMs/IP and add GitHub OAuth login 2026-05-04 18:42:25 -03:00
AcceptInviteController.php feat: @mentions in comments, AI Action layer + MCP tools, settings tabs 2026-05-01 20:59:03 -03:00
AuthenticatedSessionController.php fix: security audit - IDOR, open redirect, authorization, session fixes 2026-03-30 14:58:25 -03:00
BlueskyController.php refactor(social): use config for OAuth hosts everywhere 2026-05-19 08:34:35 -03:00
EmailVerificationNotificationController.php refactor: restructure to Actions, subdomain routes (app/api), API tokens 2026-03-29 19:24:28 -03:00
EmailVerificationPromptController.php refactor: restructure to Actions, subdomain routes (app/api), API tokens 2026-03-29 19:24:28 -03:00
FacebookController.php feat: localize OAuth popup callback messages across 12 controllers 2026-05-07 14:03:52 -03:00
GitHubController.php revert: keep one OAuth callback URL per provider 2026-05-04 19:42:13 -03:00
GoogleController.php revert: keep one OAuth callback URL per provider 2026-05-04 19:42:13 -03:00
InstagramController.php feat: localize OAuth popup callback messages across 12 controllers 2026-05-07 14:03:52 -03:00
InstagramFacebookController.php feat: localize OAuth popup callback messages across 12 controllers 2026-05-07 14:03:52 -03:00
LinkedInController.php fix(linkedin): drop deprecated r_basicprofile from default scopes 2026-06-10 13:51:07 -03:00
LinkedInPageController.php fix(linkedin-page): persist OAuth scopes through the page-picker flow 2026-05-14 11:48:30 -03:00
MastodonController.php feat: localize OAuth popup callback messages across 12 controllers 2026-05-07 14:03:52 -03:00
NewPasswordController.php feat: improvements on invites 2026-01-20 16:53:54 -03:00
PasswordResetLinkController.php feat: improvements on invites 2026-01-20 16:53:54 -03:00
PinterestController.php refactor: remove debug logging from social OAuth controllers 2026-05-14 11:23:40 -03:00
RegisteredUserController.php feat(auth): self-hosted registration gate + admin seeder (closes #46) 2026-05-19 11:45:16 -03:00
SignupSuccessController.php chore: tracking, gtm and more 2026-03-30 21:32:43 -03:00
SocialController.php feat: localize OAuth popup callback messages across 12 controllers 2026-05-07 14:03:52 -03:00
ThreadsController.php feat: localize OAuth popup callback messages across 12 controllers 2026-05-07 14:03:52 -03:00
TikTokController.php refactor: remove debug logging from social OAuth controllers 2026-05-14 11:23:40 -03:00
VerifyEmailController.php refactor: restructure to Actions, subdomain routes (app/api), API tokens 2026-03-29 19:24:28 -03:00
XController.php feat: redesign accounts page with multi-account support 2026-04-14 19:48:35 -03:00
YouTubeController.php feat: localize OAuth popup callback messages across 12 controllers 2026-05-07 14:03:52 -03:00