Providers
LinkedIn Provider
Configure LinkedIn OAuth for Keyloom authentication - setup, scopes, and professional profile access.
LinkedIn Provider
Enable LinkedIn OAuth authentication in your Keyloom application for professional networking integration.
Prerequisites
- LinkedIn app created at LinkedIn Developer Portal
- Keyloom handler configured at
/api/auth/[...keyloom]
Setup
1. Create LinkedIn App
- Go to LinkedIn Developer Portal
- Click "Create App"
- Fill in required information:
- App name
- LinkedIn Page (create a company page if needed)
- App logo and description
2. Configure OAuth Settings
- In your LinkedIn app, go to "Auth" tab
- Add redirect URL:
${YOUR_APP_URL}/api/auth/oauth/linkedin/callback - Request access to required scopes (see Available Scopes below)
3. Get Credentials
From your LinkedIn app's Auth tab:
- Client ID: Your LinkedIn app's Client ID
- Client Secret: Your LinkedIn app's Client Secret
4. Environment Variables
LINKEDIN_CLIENT_ID=your_linkedin_client_id
LINKEDIN_CLIENT_SECRET=your_linkedin_client_secret5. Configure Provider
import { defineKeyloom } from "@keyloom/core";
import { linkedin } from "@keyloom/providers";
export default defineKeyloom({
providers: [
linkedin({
clientId: process.env.LINKEDIN_CLIENT_ID!,
clientSecret: process.env.LINKEDIN_CLIENT_SECRET!,
scopes: ["openid", "profile", "email"], // Optional: customize scopes
}),
],
// ... other config
});Configuration Options
linkedin({
clientId: string;
clientSecret: string;
scopes?: string[]; // Default: ["openid", "profile", "email"]
})Available Scopes
Basic Scopes (No Review Required)
openid- OpenID Connect authenticationprofile- Basic profile informationemail- Email address
Advanced Scopes (Require Review)
w_member_social- Share content on behalf of userr_organization_social- Read organization contentrw_organization_admin- Manage organization pages
Recommended: Start with basic scopes for authentication purposes.
User Profile
LinkedIn returns the following user information:
{
id: string; // LinkedIn member ID
email: string; // User's email address
name: string; // Full name
image?: string; // Profile picture URL
// Additional LinkedIn profile data available
}Usage Example
import { useLogin } from "@keyloom/react";
export function LinkedInSignIn() {
const { login, loading } = useLogin();
const handleLinkedInLogin = async () => {
await login({
provider: "linkedin",
callbackUrl: "/dashboard",
});
};
return (
<button onClick={handleLinkedInLogin} disabled={loading}>
{loading ? "Connecting..." : "Sign in with LinkedIn"}
</button>
);
}Professional Use Cases
LinkedIn integration is ideal for:
- B2B Applications: Professional networking features
- Recruitment Platforms: Access to professional profiles
- Business Tools: Company page management
- Professional Services: Industry-specific applications
App Review Process
For advanced scopes, LinkedIn requires app review:
- Complete app verification process
- Provide detailed use case documentation
- Include privacy policy and terms of service
- Demonstrate compliance with LinkedIn API Terms
Troubleshooting
Invalid redirect URI
- Ensure redirect URI matches exactly in LinkedIn app settings
- Use HTTPS for production applications
Scope access denied
- Verify requested scopes are approved for your app
- Check if scopes require LinkedIn review process
Rate limiting
- LinkedIn has rate limits on API calls
- Implement proper retry logic with exponential backoff
Security Considerations
- Store client secret securely (environment variables)
- Use HTTPS in production
- Follow LinkedIn's API Terms of Use
- Respect user privacy and data usage policies
- Regularly audit app permissions
Migration Notes
LinkedIn has deprecated some older API versions:
- Use Sign In with LinkedIn v2 API
- Migrate from v1 profile fields to v2 format
- Update scope names to current standards
See also
How is this guide?