Halloween DealsAmazon USHalloween week deals: useful picks before month-endAmazon US: current deals, useful picks and tech finds.Check DealsClean PCRecommendedOne scan can reveal what keeps slowing WindowsLook for cleanup and repair opportunities.Run ScanHalloween DealsAmazon USOctober picks are moving - compare before checkoutAmazon US: current deals, useful picks and tech finds.See Picks×
FREEDOM251

Freedom251 › Blog › automation tokens

npm Trusted Publishing vs. Automation Tokens: Which Should You Use?

By Freedom251 Team · · 10 min read

What’s actually slowing this PC down?

Pick the symptom - the matching free tool is one click away.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Use npm trusted publishing for package releases whenever your CI workflow runs on a currently supported provider and runner. It exchanges the workflow’s OIDC identity for a short-lived publishing credential, so the publish job does not need a long-lived write token. Keep a granular read-only token for installing private packages, and use a tightly scoped automation token only when your publishing environment cannot use trusted publishing or when a separate npm operation still requires token authentication.

What the two methods actually do

The choice is not simply “OIDC instead of every npm token.” The two mechanisms authenticate different kinds of work.

As an Amazon Associate I earn from qualifying purchases.

Trusted publishing

Trusted publishing creates a relationship between an npm package and a specific CI/CD provider workflow. During a release, the provider issues an OIDC identity token. npm verifies that identity against the publisher configuration and exchanges it for a short-lived credential for the permitted publishing operation. The credential exists for the job rather than as a permanent secret in the repository or CI settings.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

This model ties authorization to the workflow identity: provider, repository or project, workflow file, and, where applicable, environment. A stolen package-publish secret is not sitting in the job because there is no long-lived write token to copy from the publish step.

#1 Best Overall
Sale
TOZO A1 Wireless Earbuds Bluetooth 5.3 Light Weight in Ear Headphones | IPX5 Waterproof,2 Mics for AI Calls,Immersive Premium Sound Bass Headset with Charging Case,32 EQ via App Black
  • [Ultra-Lightweight Ear Buds Designed for Small Ears] Each earbud weighs only 3.7g and features a compact, ergonomic in-ear design made especially for small ears. Secure, low-profile, and comfortable for workouts, all-day wear or overnight sleeping.The ultra-slim profile sits flush in your ear with no hard edges poking or rubbing, so you can even sleep on your side without discomfort.
  • [Immersive Stereo Sound with TOZO OrigX Technology] TOZO OrigX tuning delivers clear vocals, balanced mids, and natural stereo sound for music, podcasts, and videos.
  • [Long Battery Life for Daily Use] Get up to 7 hours of playtime on a single charge, with up to 32 hours total using the charging case—ideal for workdays, commuting, and extended listening sessions.
  • [Bluetooth 5.3 & Stable Connection] Bluetooth 5.3 provides fast pairing, stable wireless performance, and reduced dropouts as you move around home or office.
  • [Deep Bass with Clear Vocals] High-performance drivers produce punchy bass while keeping vocals clean and detailed for everyday listening.

Automation tokens

An automation token is a persistent npm access credential stored by your CI system and presented to the registry. Granular tokens can be limited by package and permission, given an expiration date, and revoked, but they remain secrets that your team must protect and rotate.

Tokens still authenticate commands that trusted publishing does not cover. npm specifically continues to require traditional authentication for commands such as install, view, and access. A package release workflow can therefore use both methods: a read-only token to install private dependencies and trusted publishing for the final release.

Decision table: which method fits your workflow?

Decision axis Trusted publishing Granular automation token
Credential in the publish job Short-lived credential obtained through OIDC; no persistent write token is required for the publish step. Persistent secret must be stored, scoped, monitored, rotated, and revoked.
Provider compatibility Currently listed for GitHub Actions on GitHub-hosted runners, GitLab.com shared runners, and CircleCI cloud. Self-hosted runners are not supported. Useful where trusted publishing is unavailable, subject to npm’s current token policy.
Typical operation Publishing or staging a package, plus explicitly permitted release operations such as dist-tag management. Any operation allowed by the token; prefer read-only permissions for dependency installation and narrowly scoped write access for automation.
Human approval Can be configured as stage-only, so a maintainer approves or rejects the staged version. A stage-only token can also submit a stage. Direct publishing with bypass-2FA granular tokens is scheduled to change in January 2027.
Provenance npm automatically generates provenance for eligible trusted publishes from public repositories using GitHub Actions or GitLab CI/CD. CircleCI is excluded from this automatic behavior. Do not assume that publishing with a token generates provenance; follow npm’s separate provenance requirements.

When npm trusted publishing is the better choice

You publish from a supported cloud runner

For GitHub Actions on GitHub-hosted runners, GitLab.com shared runners, or CircleCI cloud, trusted publishing is npm’s preferred approach for CI/CD releases. It removes the highest-value npm write secret from the publish job and lets npm check the workflow identity at release time.

Free tools Windows power users keep installed

One-click scans. No signup required.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

You want identity-based authorization

A token answers “does this secret have permission?” Trusted publishing additionally answers “is this the configured workflow running in the configured project?” That distinction helps prevent a copied token from being reused in an unrelated pipeline. It also makes a repository or workflow change an authorization event: if the configured identity no longer matches, the release fails instead of silently accepting a different job.

You need staged releases

Trusted publishing can be configured for stage-only access. The workflow submits a version to npm’s staging system, and a maintainer reviews it before approval or rejection. This separates build automation from the human decision to make a version publicly available.

Rank #2
Sale
Smart Watch for Men Women Compatible with iPhone Samsung Android Phone 1.69 inch Full Touch Screen IP68 Waterproof Bluetooh Fitness Tracker Heart Rate/Sleep Monitor (Black)
  • 【IP68 Waterproof Multifunctinal Smart Watch】Torjalph fitness activity tracker smart watch is IP68 waterproof technology ,you can wear it when swimming,handwashing,it's rain-proof which means that you perform multiple exercise modes outside without worrying about sweat or rain corroding your fitness smart watch,and this watch equipped with a 230 mAh large capacity battery magnetic charging ,and this sports activity tracker watch can be used 5-7 days If fully charged.
  • 【Larger 1.83'' Full Screen Watch & Multi-dial Selection】1.83 inch full HD color touch screen smart watch for men / women provides excellent 240*284 resolution image quality ,This Bluetooth smart watch offers a better touch experience and remarkable immersion and ,more than 200 watch faces for you to choose from App"Da Fit ", you can change the dial style according to your mood to wear keeping the world on your wrist
  • 【Accurate Activity Tracker Smart Watch 】sports watch activity tracker uses sweat and dust resistant breathable silicone strap, our Fitness Tracker Smart Watch for Android iOS Phones supports 12 sports modes,walking,running,bicycle,swimming,badminton,basketball,football,rope skipping. This bluetooth calls smart watch for men women is lightweight and stylish, bringing more convenient and relaxing sports experience while also providing more protection.
  • 【Your 24 Hour Personal Daily Health Monitor】Fitness watch for women men full touch screen IP67 waterproof bluetooth smartwatch for Android iOS Phones with heart rate blood pressure monitor multifunction Andriod smart watch with steps counter sleep monitor sports fitness watch, monitoring blood oxygen saturation allows you to understand your physical condition in real time to track fitness progress ,to know your health status in time.
  • 【More Functions Bluetooth Call Smart Watch】This fitness activity smart watch full screen for iPhone and Android phones includes a bunch of new features including:The bluetooth smart watch can hang up the phone, receive and display WhatsAPP /Text /Facebook /Twitter /Messenger reminder.Support sedentary reminder, alarm clock, stopwatch, timer,weather information,music control, remote camera control compatible with Android 5.0 and above or iOS 9.0 and above smartphones.

When an automation token is still necessary

Installing private dependencies

Trusted publishing is not a general npm login replacement. A release job that runs npm install or npm ci against private packages normally needs traditional authentication. Use a granular read-only token, restrict it to the packages or organization it must read, and expose it only to the dependency-install step when your CI system supports step-level secrets.

Running unsupported providers or runners

npm’s current trusted-publishing list is provider- and runner-specific. Self-hosted runners are not supported in the documented configuration. If your pipeline runs on an unsupported service, a private runner, or a provider not on npm’s live list, a granular token may be required for publishing. Verify the support list immediately before implementation because provider coverage can change.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Using npm commands outside publishing

Commands such as npm view, npm access, and authenticated package installation continue to use token-based or other traditional authentication. Configure a token with only the permissions needed for those commands rather than giving every job a publish-capable secret.

Maintaining an interim migration path

If a team cannot move its release pipeline immediately, a granular token with a short expiration and restricted package access can be an interim measure. Treat it as a temporary exception: document its owner, expiration, package scope, rotation procedure, and revocation procedure.

Trusted-publishing prerequisites

npm documents minimum tool versions of Node.js 22.14.0 and npm CLI 11.5.1 for trusted publishing. Pin or otherwise control those versions in the release environment so a runner image update does not unexpectedly change authentication behavior.

Rank #3
New Bee Guitar Cable 10ft Electric Instrument Bass AMP Cord | 6.35mm Jack, Durable Design, Stage and Home Studio Use, Low Noise Shielded Electric Cord for Bass, Keyboard, Amp, Mixer
  • [Low Noise High Fidelity] New bee guitar cord with 22AWG oxygen-free-copper center conductors provides enhanced signal transfer, the PVC insulation material and the high-density stranded copper double shield provide noise rejection for quiet operation
  • [Ideal for Choice] New bee 1/4 straight and right angle metal connectors, ensures a secure connection in any instrument, pedal, or amp jack. L shape great fro on stage guitar stands
  • [Wide Compatible] Suitable for mixer, power amplifier, microphone, effector, decoder, equalizer, electoronic organ, electric guitar, electric bass and other electronic equipments. Widely used in the installation of smart home, karaoke speaker, professional stage audio, etc
  • [Easy Disassemble] Making incidental repairs quick and easy! Very nice, flexible cable
  • [Dont Hesite to Order] 24 hours customer services and professional technology team are standing by
  • Supported execution environment: GitHub-hosted GitHub Actions runner, GitLab.com shared runner, or CircleCI cloud, according to npm’s current support list.
  • OIDC permission: GitHub Actions must grant id-token: write to the workflow or the job that publishes.
  • Exact identity match: The npm publisher configuration must match the repository and workflow metadata. For GitHub Actions, the configured workflow filename must match the file used by the release job.
  • Provider-specific audience or variable: GitLab’s OIDC token audience must be npm:registry.npmjs.org. CircleCI exposes its OIDC token as NPM_ID_TOKEN.
  • Initial activation window: A newly created trusted-publisher configuration expires if it does not complete its first successful publish within two days.

How to set up trusted publishing safely

1. Confirm the provider and runner

Start with the actual runner that executes the publish job, not merely the CI vendor’s name. GitHub Actions is supported here only on GitHub-hosted runners; self-hosted GitHub runners are not. GitLab support refers to GitLab.com shared runners, and CircleCI support refers to CircleCI cloud.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

2. Bring the toolchain up to the documented minimum

Install Node.js 22.14.0 or later and npm CLI 11.5.1 or later in the release job. Verify both before publishing:

node --version
npm --version

The output should show at least the documented versions. If your organization pins a newer LTS image, confirm that its bundled npm version also meets the minimum.

3. Create the publisher connection on the package

In npm’s package settings, add a trusted publisher and select the provider. Enter the exact repository, project, workflow, and environment fields requested for that provider. Do not copy identifiers from a similarly named repository or from a pull-request workflow; the identity must be the one that will perform the release.

Each package can have up to 10 trusted publishers. Existing connections cannot be edited in place. To change a provider or a required identity field, delete the old connection and create a new one.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Rank #4
BSIMB 15.6" Digital Family Calendar & Chore Chart, No Subscription Fees
  • Digital Family Calendar: BSIMB digital calendar wall touch screen puts an end to your chaotic life. Designed for busy families, the digital calendar keeps you organised and in step with your family. Assign different colours and tasks to each family member to make family scheduling easier and more intuitive.
  • Easy Setup and Auto-Sync: Plug in, connect to WLAN and auto-syn your electric calendar in minutes. Digital wall calendar compatible with Google calendar, iCloud calendar, Outlook calendar, Cozi calendar and Yahoo calendar. Add events directly on the device or through the ecalendar app. Electronic calendar stays current whether you're at work or traveling—no manual updates needed.
  • All-In-One Home Assistant: Smart calendar builds habits and encourage independence with personalised chores. Display daily meal plan to reduce the daily ‘What's for dinner?’ stress. To-do lists keep track of everything you want. Turning chores into valuable achievements with stars and rewards, making life easier and more enjoyable.
  • Manage Anytime Anywhere: BSIMB electronic calendar for family stay connected with the powerful ecalendar app. Access and manage your digital wall calendar anytime, anywhere with free features like stars & rewards, photo screensaver, chore charts, meals plans, to-do lists etc. Electronic planner paid features like Magic Import tailor advanced tools for users with special needs.
  • Stay in Touch with Loved Ones: Share photos or videos from your phone to electronic wall calendar with app, instantly update your life moment, and keep in touch with your family, especially those who are far away; you can also surprise your smart calendar digital wall by sending him a wish card; it's also great for keeping tech-illiterate elders in touch with the youngsters.

4. Configure the workflow’s OIDC permissions

For GitHub Actions, grant the release job permission to mint an OIDC identity token:

permissions:
  contents: read
  id-token: write

This snippet only illustrates the required permission; the rest of a workflow is provider-specific. GitLab and CircleCI use their own OIDC configuration and should not be treated as interchangeable YAML.

5. Choose direct publishing or staging

Give the publisher only the release capability it needs. Direct publishing makes the approved workflow’s version publicly available. Stage-only publishing creates a human release gate; a maintainer then approves or rejects the staged version.

6. Complete a successful publish within two days

After creating the connection, run a real successful publish within the two-day activation window. A failed test does not establish a working publisher, so monitor the job through registry confirmation and package metadata. If the configuration expires, recreate it and repeat the test.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Provider-specific details that commonly cause failures

GitHub Actions

The most common errors are a missing id-token: write permission and a mismatch between the npm publisher’s repository or workflow filename and the actual workflow. Check the branch and environment used by the release job as well; an environment-specific identity must match the configured environment.

GitLab CI/CD

Set the OIDC token audience to exactly npm:registry.npmjs.org. An otherwise valid token with a different audience will not satisfy npm’s trusted-publisher check.

CircleCI

Use the OIDC token exposed as NPM_ID_TOKEN. CircleCI is supported for trusted publishing, but npm does not include CircleCI in the automatic provenance behavior described for eligible public-repository GitHub Actions and GitLab CI/CD publishes.

Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

How to handle tokens when you adopt OIDC

Separate read and write credentials

Do not leave a publish-capable token in a job that only installs dependencies. Create a granular read-only token for private package installation and use trusted publishing for the release job. If one workflow performs both tasks, keep the token available only where installation requires it and ensure the publish command uses the OIDC path.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Constrain any remaining write token

When a token is unavoidable, limit package access, grant only the required operation, set an expiration, store it in the CI provider’s encrypted secret store, and prevent it from appearing in logs. Record who owns rotation and how to revoke it after a failed or suspicious run.

Plan for the January 2027 policy change

npm’s access-token documentation says bypass-2FA granular tokens with direct-publish access are scheduled to lose direct publishing in January 2027. This is a future-dated policy and should be checked against npm’s current documentation before you rely on it. The documented preparation options are to adopt trusted publishing or use a read-and-write stage-only token with staged publishing, followed by maintainer approval.

Provenance and supply-chain expectations

Trusted publishing and provenance are related but not identical. npm automatically generates provenance for eligible trusted publishes from public repositories using GitHub Actions and GitLab CI/CD. CircleCI does not receive that automatic behavior in the documented setup. Token-based publishing alone should not be treated as proof that provenance was generated; use npm’s separate provenance requirements when attestations are part of your release policy.

Record which workflow produced each version, which identity was authorized, and whether the release was direct or staged. Those records help an incident responder distinguish a valid release from a credential misuse event.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

A migration plan for an existing token-based pipeline

  1. Inventory current access. List every workflow that publishes, installs private packages, runs npm view, or uses npm access. Identify each token’s package scope, permissions, owner, and expiration.
  2. Separate responsibilities. Create or retain a read-only token for private dependency installation. Remove publish permissions from jobs that do not release packages.
  3. Verify support and versions. Confirm the actual runner is supported and install Node.js 22.14.0 or later with npm CLI 11.5.1 or later.
  4. Create the trusted publisher. Enter exact provider, repository, workflow, and environment identifiers. Decide whether the package should publish directly or stage for approval.
  5. Run a controlled release. Grant the provider’s OIDC permission, publish a test version or planned release, and confirm npm accepts the identity and records the package version correctly.
  6. Exercise the failure path. Check that a changed workflow filename, wrong repository, missing permission, or unsupported runner is rejected. A secure setup should fail closed rather than silently fall back to an old write token.
  7. Revoke unused credentials. After a successful OIDC release, revoke obsolete publish tokens, remove them from CI variables, and update runbooks. Keep only tokens required for private installs or other authenticated npm commands.

Troubleshooting checklist

  • “OIDC token unavailable” in GitHub Actions: add id-token: write at workflow or job scope and verify the job receiving the permission is the one running the publish command.
  • Identity mismatch: compare the configured repository, workflow filename, project, and environment character for character with the executing pipeline.
  • Provider rejected: confirm you are using a supported cloud runner, not a self-hosted runner or an unsupported service.
  • Version error: print node --version and npm --version; upgrade to Node.js 22.14.0 or later and npm CLI 11.5.1 or later.
  • Private dependency install fails while publish succeeds: add a granular read-only token for the install command. Trusted publishing does not authenticate arbitrary package reads.
  • New publisher no longer works after setup: check whether the two-day first-success window elapsed. Recreate the connection if it expired.
  • Dist-tag operation denied: publishing or staging permission does not automatically grant dist-tag management. Configure that operation separately if the release process needs it.
  • Provenance is missing: check the provider and repository visibility. Automatic provenance is described for eligible public-repository GitHub Actions and GitLab CI/CD trusted publishes, not every provider or token-based release.

Practical recommendations by scenario

Your situation Recommended arrangement
Public package released from GitHub-hosted GitHub Actions Use trusted publishing, grant id-token: write, and match the repository and workflow fields exactly. Use a separate read-only token only if the build installs private packages.
Package released from GitLab.com shared runners Use trusted publishing and set the OIDC audience to npm:registry.npmjs.org. Confirm the project and pipeline identity match the npm configuration.
Package released from CircleCI cloud Use trusted publishing with the NPM_ID_TOKEN OIDC variable. Do not assume the automatic provenance behavior documented for GitHub Actions and GitLab applies to CircleCI.
Self-hosted runner or unsupported provider Check npm’s current support list. If OIDC is unavailable, use a granular token with restricted package access, short expiration, secure storage, and a migration plan.
Release must be reviewed by a person Configure stage-only publishing and require a maintainer to approve or reject each staged version.
CI only installs private packages Use a granular read-only token; trusted publishing is unnecessary for an install-only job.

Bottom line for the choice

For a supported cloud CI/CD publisher, choose npm trusted publishing. It gives npm a verifiable workflow identity and a short-lived release credential while removing a persistent write secret from the publish job. Do not remove every npm token from your infrastructure: retain a granular read-only token for private dependencies and token authentication for commands that OIDC publishing does not cover. If your runner is unsupported, use the narrowest expiring token that works, and plan the migration before npm’s announced January 2027 direct-publishing change.

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

automation tokensCI/CDnpmOIDCsoftware supply chaintrusted publishing

Leave a Reply

Your email address will not be published. Required fields are marked *

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Recommended PC Tool
Recommended PC Tool
Outdated Drivers Are Slowing You DownFree scan - exact matches
PC Slower Than It Used to Be?Free scan - under a minute

Two free Windows tools

One Free Minute Could Fix That PC

Before you go - each of these free tools takes about a minute and tackles what quietly slows a Windows PC down.

Special offer. View Outbyte info, uninstall instructions, EULA, and Privacy Policy.