npm-keep-me-logged-in
v1.2.1
Published
Keeps you logged in to npm registry so you don't have to run `npm login` every day
Readme
🔐 npm-keep-me-logged-in
Stop running npm login every day. Create long-lived npm access tokens (up to 90 days) and stay logged in to npm without daily authentication prompts.
npx npm-keep-me-logged-inThe Problem
Since npm deprecated classic tokens, npm login tokens now expire after just 2 hours. If you use private npm packages, you're forced to re-authenticate multiple times per day. This is especially frustrating for developers working with private registries and organization packages.
This tool fixes the npm login expiration problem by creating proper granular access tokens that last up to 90 days - no more daily npm login prompts.
How It Works
This is a transparent wrapper around official npm commands. It automates what you could do manually:
- Runs
npm loginto create a fresh session - Discovers your organizations from published packages
- Prompts you to configure the token (name, expiration, organizations, 2FA bypass)
- Runs
npm token createwith your chosen settings (npm handles password/2FA) - Optionally updates
~/.yarnrc.ymlwith the new token
Your credentials never leave your machine. Everything happens locally using official npm CLI commands.
Security & Privacy
- ✅ Open source - Full code transparency
- ✅ No data collection - Everything runs locally
- ✅ No password storage - Passed directly to npm's official prompt
- ✅ No file access - Only reads
~/.npmrcif you choose to update Yarn config - ✅ Official npm commands - Uses the same
npm token createyou'd use manually - ✅ Timestamped backups - Config files are backed up before modification
Requirements
- Node.js 18+
- npm 11+ (for granular token CLI support)
- 2FA enabled on your npm account
Quick Start
Fix your npm login expiration issues in under a minute:
npx npm-keep-me-logged-inThe interactive CLI guides you through:
- Token name - Default:
npm-keep-me-logged-in-YYYY-MM-DD - Expiration - Choose 7, 30, 60, or 90 days (recommended: 90)
- Organizations - Auto-detected from your published packages
- 2FA bypass - Optional (not recommended for security)
- Yarn config - Automatically update
~/.yarnrc.yml(optional)
What You Get
Long-lived npm authentication tokens with:
- ✅ 90-day expiration - Stop logging in daily
- ✅ Read/write access to all your packages
- ✅ Organization support - Works with private org packages
- ✅ Yarn compatibility - Auto-configures Yarn Berry if needed
- ✅ Automatic renewal - Just run again when token expires
Notes
- If a token with the same name exists, a random suffix is added (e.g.,
npm-keep-me-logged-in-2026-01-19-a3f) - Config backups are saved as
~/.npmrc.backup.TIMESTAMPand~/.yarnrc.yml.backup.TIMESTAMP - You can manage tokens at npmjs.com/settings/~/tokens
License
MIT - This tool is not affiliated with npm, Inc.
