npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@ubaidbinwaris/linkedin-login

v2.1.3

Published

![Version](https://img.shields.io/npm/v/@ubaidbinwaris/linkedin?style=flat-square) ![License](https://img.shields.io/npm/l/@ubaidbinwaris/linkedin?style=flat-square) ![Node](https://img.shields.io/node/v/@ubaidbinwaris/linkedin?style=flat-square)

Readme

@ubaidbinwaris/linkedin - Enterprise Automation Service

Version License Node

A professional, deterministic backend service library for managing multiple LinkedIn accounts with strict concurrency control, session isolation, and enterprise-grade security.

v1.1.7 Update: Introduces "Smart Mobile Verification" with Visible Browser Fallback.

🚀 Key Features

  • 🛡️ Multi-User Concurrency: Built-in SessionLock prevents race conditions. Impossible to double-login the same user.
  • 🔒 Enterprise Security:
    • Sessions stored as SHA-256 hashed filenames (GDPR/Privacy friendly).
    • Data encrypted with AES-256-CBC before storage.
  • 🧠 Smart Validation:
    • Caches validation checks for 10 minutes to minimize ban risk from excessive reloading.
    • Automatically refreshes stale sessions.
  • 📱 Mobile & Fallback Support:
    • Phase 1: Detects "Open LinkedIn App" prompt and waits 2 minutes for user approval.
    • Phase 2: If mobile fails, automatically launches a Visible Browser for manual intervention.

🏗️ Architecture

The library follows a strict Fail-Fast or Resolution flow. It does not use "stealth" plugins, relying instead on standard browser behavior and human intervention protocols.

sequenceDiagram
    participant API as API/Worker
    participant Pkg as LinkedIn Package
    participant Browser as Playwright
    participant Store as Session Store

    API->>Pkg: loginToLinkedIn(email, pass)
    Pkg->>Pkg: Acquire Lock (SessionLock)
    alt is Locked
        Pkg-->>API: Throw BUSY Error
    end

    Pkg->>Browser: Launch (Headless)
    Pkg->>Store: Load Context
    
    alt Session Valid & Recent
        Pkg-->>API: Return Page (Skip Feed)
    else Session Stale/Invalid
        Pkg->>Browser: Goto Feed
        
        alt Login Required
            Pkg->>Browser: Fill Credentials
            Pkg->>Browser: Submit
            
            opt Checkpoint Detected
                Pkg->>Browser: Check Mobile Prompt
                alt Mobile Prompt Found
                    Pkg->>Pkg: Wait 2 Mins for Feed URL
                end
                
                alt Mobile Failed
                    Pkg->>Browser: Close Headless
                    Pkg->>Browser: Launch VISIBLE Browser
                    Pkg->>Browser: Re-Fill Credentials
                    Pkg->>Pkg: Wait for Manual Use
                end
            end
        end
        
        Pkg->>Store: Save Session (Encrypted)
        Pkg-->>API: Return Page
    end

📦 Installation

npm install @ubaidbinwaris/linkedin

💻 Usage

1. Basic Implementation

The simplest way to use the package. Locks and session management are handled automatically.

const { loginToLinkedIn } = require('@ubaidbinwaris/linkedin');

(async () => {
    try {
        const { browser, page } = await loginToLinkedIn({
            headless: true // Will auto-switch to false if fallback needed
        }, {
            username: '[email protected]',
            password: 'secure_password'
        });

        console.log("✅ Logged in successfully!");
        
        // ... Perform scraping/automation tasks ...

        await browser.close();
        
    } catch (err) {
        if (err.message === 'CHECKPOINT_DETECTED') {
            console.error("❌ Critical: Account requires manual ID verification.");
        } else if (err.message.includes('BUSY')) {
            console.error("⚠️  User is already running a task.");
        } else {
            console.error("Error:", err.message);
        }
    }
})();

2. Custom Storage (Database Integration)

By default, sessions are saved to ./sessions. Override this to use Redis, MongoDB, or PostgreSQL.

const { setSessionStorage } = require('@ubaidbinwaris/linkedin');

setSessionStorage({
    read: async (email) => {
        // Return encrypted JSON string from your DB
        const result = await db.query('SELECT session_data FROM users WHERE email = $1', [email]);
        return result.rows[0]?.session_data; 
    },
    write: async (email, data) => {
        // Save encrypted JSON string to your DB
        await db.query('UPDATE users SET session_data = $1 WHERE email = $2', [data, email]);
    }
});

3. Custom Logger

Pipe internal logs to your own system (e.g., Winston, UI Stream).

const { setLogger } = require('@ubaidbinwaris/linkedin');

setLogger({
    info: (msg) => console.log(`[LI-INFO] ${msg}`),
    warn: (msg) => console.warn(`[LI-WARN] ${msg}`),
    error: (msg) => console.error(`[LI-ERR] ${msg}`)
});

🚨 Error Reference

| Error Message | Meaning | Handling Action | | :--- | :--- | :--- | | CHECKPOINT_DETECTED | Security challenge (ID upload/Captcha) could not be resolved. | Notify admin. Manual Login required. | | CHECKPOINT_DETECTED_M | Manual Fallback (Visible Browser) timed out. | User didn't interact in time. Retry. | | BUSY: ... | A task is already running for this email. | Queue the request or reject it. | | LOGIN_FAILED | Credentials accepted, but session could not be verified. | Check proxy/network. |

License

ISC