- How do I install socialiteproviders/linkedin in a Laravel app?
- Install it with Composer using composer require socialiteproviders/linkedin. It is a driver for Laravel Socialite, so the base laravel/socialite package must also be present. After installing, add your LinkedIn client credentials to config/services.php, register the provider extension listener if you do not rely on package discovery, then create redirect and callback routes that call Socialite::driver('linkedin').
- Which Laravel, PHP, and Socialite versions does this LinkedIn provider support?
- Supported versions are defined in the package composer.json constraints, so check them against your application before upgrading. Because this repository is a read-only subtree split, the most reliable compatibility information comes from the upstream SocialiteProviders/Providers releases rather than this repo alone. Pin the version in Composer, then run the redirect and callback flow in staging after any upgrade of Laravel, PHP, or Socialite.
- How do I configure LinkedIn credentials and the redirect URI in config/services.php?
- Add a linkedin entry to config/services.php containing client_id, client_secret, and redirect, and read those values from environment variables such as LINKEDIN_CLIENT_ID, LINKEDIN_CLIENT_SECRET, and LINKEDIN_REDIRECT_URI. The redirect value must match the authorized redirect URL registered in the LinkedIn developer app exactly, including scheme, host, trailing slash, and port. Redirect URI mismatches and separate credentials per environment are the most common causes of failed LinkedIn logins.
- What LinkedIn scopes does this provider request, and how do I need to configure my LinkedIn app?
- Modern releases use LinkedIn's OpenID Connect scopes, typically openid, profile, and email, while older releases relied on the legacy r_liteprofile and r_emailaddress scopes. Your LinkedIn developer app must have the corresponding products approved and the redirect URL registered before the flow will work. Check the release notes for the version you install, because LinkedIn has changed its authentication model and available scopes over time.
- What profile fields does the provider return after the callback?
- You receive a Socialite user object with the usual accessors such as getId, getName, getEmail, and getAvatar, populated from the LinkedIn response for the scopes you were granted. The identifier is LinkedIn's subject claim, which is stable for the user and should be the key you store for lookups. Available fields depend on approved scopes, so treat name, email, and picture as optional and handle nulls defensively.
- How do I handle users whose LinkedIn account has no email address?
- LinkedIn may not return an email if the email scope is not approved or if the member has no confirmed primary email on the account. Read getEmail defensively and do not assume it is present or verified. Have a fallback path that asks the user to supply an email or links them by LinkedIn subject ID, and never silently create an account with a null or fabricated email address.
- Can I use this package to post to LinkedIn, manage company pages, or call other LinkedIn APIs?
- No. This package only adds a Socialite driver for the redirect, callback, and user-retrieval flow, so it is authentication only. Publishing posts, reading organization pages, ads, or other LinkedIn API operations require a separate LinkedIn API client and additional approved products and scopes. If your requirement goes beyond sign-in, plan for a broader integration rather than treating this as a full LinkedIn SDK.
- How do I prevent account takeover when linking LinkedIn to an existing user?
- Decide your linking rules before launch: match on LinkedIn's subject ID first, and only match on email if you have verified that the email is trustworthy. If you auto-link by email, require the email to be verified and consider requiring an existing authenticated session before attaching a LinkedIn identity. Also guard against duplicate accounts and log linking events so suspicious or conflicting matches can be audited.
- How do I test LinkedIn login in Laravel without hitting real LinkedIn?
- Mock the Socialite driver in feature tests, for example by faking the driver and returning a user object with the ID, name, and email your controller expects. For lower-level tests, fake the outbound HTTP calls to the LinkedIn token and userinfo endpoints. Cover callback failures, denied consent, invalid state, missing email, and duplicate-account paths, then do a final manual validation in staging with a real LinkedIn app and account.
- Is socialiteproviders/linkedin maintained, and what alternatives should I consider?
- This repository is a read-only subtree split, so fixes and security updates flow through the upstream SocialiteProviders/Providers project, which is community maintained. The package is fine for Socialite-based LinkedIn sign-in, but pin versions, track upstream releases, and define an internal owner with a plan to fork or vendor the driver if maintenance stalls. If you need more than authentication, evaluate a dedicated LinkedIn API client instead of this provider.