Authentication Guide

Install Three Blocks in 60 Seconds

Run one command to authenticate. The CLI handles everything automatically.

License Required

Get started with Three Blocks by subscribing to access private packages.

Local Development

Run the CLI once to authenticate. It configures everything automatically.

1

Run the Login CLI

terminal
npx -y three-blocks-login@latest

The CLI opens your browser to log in with your Three Blocks account. After authentication, it automatically creates .npmrc with the registry URL and auth token.

Login options:

Browser login (default) - Opens browser, one-click authentication

Paste secret key - For headless environments, paste your tb_ key

2

Install Packages

terminal
npm install @three-blocks/core@latest

Done!

You're authenticated and ready to code.

Tokens expire after 12 hours. If you see 401 errors, just run npx -y three-blocks-login@latest again.

Deploy to CI/CD

Configure your CI to run the login CLI before install. Works with all platforms.

pnpm users: Don't use preinstall hooks. pnpm resolves packages BEFORE running preinstall scripts, causing 401 errors. Use the CI config approach below.

1

Set License Key

Add THREE_BLOCKS_SECRET_KEY to your CI environment variables. Your key starts with tb_ and can be found in your account dashboard.

Vercel: Project Settings → Environment Variables

Amplify: App Settings → Environment Variables

GitHub Actions: Settings → Secrets and Variables → Actions

Netlify: Site Settings → Environment Variables

2

Configure CI to Run Login Before Install

The login CLI creates .npmrc with registry + token at build time.

Vercel
vercel.json
{
  "installCommand": "npx -y three-blocks-login@latest && pnpm install"
}
AWS Amplify
amplify.yml
version: 1
frontend:
  phases:
    preBuild:
      commands:
        - npx -y three-blocks-login@latest
        - pnpm install
    build:
      commands:
        - pnpm build
GitHub Actions
.github/workflows/*.yml
- name: Auth three-blocks
  run: npx -y three-blocks-login@latest
  env:
    THREE_BLOCKS_SECRET_KEY: ${{ secrets.THREE_BLOCKS_SECRET_KEY }}

- name: Install dependencies
  run: pnpm install
Netlify
netlify.toml
[build]
  command = "npx -y three-blocks-login@latest && pnpm install && pnpm build"

Alternative: preinstall hook (npm/yarn only)

Does NOT work with pnpm - pnpm resolves packages before preinstall runs.

package.json
{
  "scripts": {
    "preinstall": "npx -y three-blocks-login@latest"
  }
}

That's it!

CI runs login before install, creating fresh auth every build.

Troubleshooting

401 Unauthorized Error

npm/pnpm says "Unable to authenticate"

Token expired (most common)

Solution: Run npx -y three-blocks-login@latest again

CI: License key not set

Solution: Add THREE_BLOCKS_SECRET_KEY to CI environment variables

Invalid or expired license

Solution: Check your account dashboard for subscription status

Vercel Build Fails

Works locally but fails on Vercel

1. Check environment variable

Vercel → Project Settings → Environment Variables → Verify THREE_BLOCKS_SECRET_KEY exists

2. Check vercel.json

Ensure installCommand runs login before install

3. Check build logs

Look for "three-blocks-login" and "✓ Authentication successful"

Security

  • Never commit .npmrc - The CLI generates it with auth tokens. Add to .gitignore.
  • Tokens expire after 12 hours - This is intentional for security. CI regenerates them each build.
  • License keys don't expire - As long as your subscription is active, your key remains valid.
  • One key per subscription - Works for all your projects and environments.

Still Having Issues?

We're here to help! Reach out through any of these channels: