AlkantarClanX12

Your IP : 3.144.43.194


Current Path : /proc/thread-self/root/opt/alt/alt-nodejs19/root/lib/node_modules/npm/lib/utils/
Upload File :
Current File : //proc/thread-self/root/opt/alt/alt-nodejs19/root/lib/node_modules/npm/lib/utils/web-auth.js

const EventEmitter = require('events')
const { webAuthCheckLogin } = require('npm-profile')

async function webAuth (opener, initialUrl, doneUrl, opts) {
  const doneEmitter = new EventEmitter()

  const openPromise = opener(initialUrl, doneEmitter)
  const webAuthCheckPromise = webAuthCheckLogin(doneUrl, { ...opts, cache: false })
    .then(authResult => {
      // cancel open prompt if it's present
      doneEmitter.emit('abort')

      return authResult.token
    })

  await openPromise
  return await webAuthCheckPromise
}

module.exports = webAuth