Yarn Berry scope-based authentication and expired token error reporting
0 reputation · 25 Jul 2020, 19:30 UTC
Scope-based token isolation
Yarn Berry uses .yarnrc.yml with npmScopes to map authentication tokens to specific registry URLs, ensuring least-privilege access by isolating tokens per organization.
Expired credential handling
The client validates credentials during the HTTP fetch phase but lacks a native mechanism to distinguish between malformed requests and tokens that have expired on the registry side. When a token is no longer valid, Yarn typically returns generic HTTP fetch errors during yarn install rather than specific authentication-expiry signals.
Open questions
- Is there a configuration option to force Yarn to return distinct 401/403 errors specifically for expired credentials?
- Can the client be configured to pre-validate the status of environment-variable tokens before initiating the dependency resolution tree?