lyswhut/lx-music-desktop · error

Missing auth code

Error message

Missing auth code

What it means

Error "Missing auth code" thrown in lyswhut/lx-music-desktop.

Source

Thrown at src/main/modules/sync/client/auth.ts:83

  // eslint-disable-next-line @typescript-eslint/promise-function-async
  return request(`${urlInfo.httpProtocol}//${urlInfo.hostPath}/ah`, { headers: { i: keyInfo.clientId, m: msg } }).then(({ text, code }) => {
    if (code != 200) throw new Error(SYNC_CODE.authFailed)

    let msg
    try {
      msg = aesDecrypt(text, keyInfo.key)
    } catch (err: any) {
      log.error('[auth] keyAuth decryptMsg error', err.message)
      throw new Error(SYNC_CODE.authFailed)
    }
    if (msg != SYNC_CODE.helloMsg) return Promise.reject(new Error(SYNC_CODE.authFailed))
  })
}

const auth = async(urlInfo: LX.Sync.Client.UrlInfo, serverId: string, authCode?: string) => {
  if (authCode) return codeAuth(urlInfo, serverId, authCode)
  const keyInfo = await getSyncAuthKey(serverId)
  if (!keyInfo) throw new Error(SYNC_CODE.missingAuthCode)
  await keyAuth(urlInfo, keyInfo)
  return keyInfo
}

export default async(urlInfo: LX.Sync.Client.UrlInfo, authCode?: string) => {
  console.log('connect: ', urlInfo.href, authCode)
  if (!await hello(urlInfo)) throw new Error(SYNC_CODE.connectServiceFailed)
  const serverId = await getServerId(urlInfo)
  if (!serverId) throw new Error(SYNC_CODE.getServiceIdFailed)
  return auth(urlInfo, serverId, authCode)
}

View on GitHub (pinned to 9c364b482e)

When it happens

Trigger: Thrown at src/main/modules/sync/client/auth.ts:83 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of lyswhut/lx-music-desktop@9c364b482e (2026-08-12). Data as JSON: /api/errors/51c90755e69846f0. Report an issue: GitHub.