How to use the npm-registry-fetch/auth.js function in npm-registry-fetch

To help you get started, we’ve selected a few npm-registry-fetch examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github graalvm / graaljs / deps / npm / lib / logout.js View on Github external
BB.try(() => {
    const reg = npmFetch.pickRegistry('foo', opts)
    const auth = getAuth(reg, opts)
    if (auth.token) {
      log.verbose('logout', 'clearing session token for', reg)
      return npmFetch(`/-/user/token/${eu(auth.token)}`, opts.concat({
        method: 'DELETE',
        ignoreBody: true
      })).then(() => afterLogout(reg))
    } else if (auth.username || auth.password) {
      log.verbose('logout', 'clearing user credentials for', reg)
      return afterLogout(reg)
    } else {
      throw new Error(
        'Not logged in to', reg + ',', "so can't log out."
      )
    }
  }).nodeify(cb)
}

npm-registry-fetch

Fetch-based http client for use with npm registry APIs

ISC
Latest version published 2 days ago

Package Health Score

92 / 100
Full package analysis