{"record":{"id":"39507384aad2010b","repo":"pot-app/pot-desktop","slug":"can-not-find-qrcodeurl-json-stringify-result","errorCode":null,"errorMessage":"Can not find qrCodeUrl: ${JSON.stringify(result)}","messagePattern":"Can not find qrCodeUrl: (.+?)","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"src/window/Config/pages/Backup/utils/aliyun.jsx","lineNumber":108,"sourceCode":"            throw new Error(`Get accessToken Error: ${JSON.stringify(result)}`);\n        }\n    }\n}\n\nexport async function qrcode() {\n    const res = await fetch('https://openapi.alipan.com/oauth/authorize/qrcode', {\n        method: 'POST',\n        body: Body.json({\n            client_id: 'bf56dd2dc03a4d3489e3dda05dd6d466',\n            scopes: ['user:base', 'file:all:read', 'file:all:write'],\n        }),\n    });\n    if (res.ok) {\n        const result = res.data;\n        if (result['qrCodeUrl'] && result['sid']) {\n            return { url: result['qrCodeUrl'], sid: result['sid'] };\n        } else {\n            throw new Error(`Can not find qrCodeUrl: ${JSON.stringify(result)}`);\n        }\n    } else {\n        const result = res.data;\n        if (result['message']) {\n            throw new Error(result['message']);\n        } else {\n            throw new Error(`Get QrCode Error: ${JSON.stringify(result)}`);\n        }\n    }\n}\n\nexport async function status(sid) {\n    const res = await fetch(`https://openapi.alipan.com/oauth/qrcode/${sid}/status`);\n\n    if (res.ok) {\n        const result = res.data;\n        if (result['status']) {\n            return { status: result['status'], code: result['authCode'] };","sourceCodeStart":90,"sourceCodeEnd":126,"githubUrl":"https://github.com/pot-app/pot-desktop/blob/594d32ede96acd106b0256deaa8bb440ffcdff40/src/window/Config/pages/Backup/utils/aliyun.jsx#L90-L126","documentation":"The aliyun `qrcode` function starts the OAuth device-login flow by POSTing to https://openapi.alipan.com/oauth/authorize/qrcode. If the response is 2xx but lacks `qrCodeUrl` and/or `sid`, the login QR cannot be displayed, so this error is thrown with the full body. It guards against Aliyun returning an unexpected success payload.","triggerScenarios":"Calling qrcode() where the authorize/qrcode endpoint responds 200 but without the expected qrCodeUrl/sid fields — e.g. the client_id (bf56dd2dc03a4d3489e3dda05dd6d466) is revoked/disabled, rate-limited QR generation, or an Aliyun API schema change.","commonSituations":"Aliyun disabled or rotated the embedded app's client_id, the user triggers login repeatedly and hits QR-generation rate limits, or the alipan OAuth API changes its response field names.","solutions":["Inspect the serialized body for an embedded error code explaining why the QR was not issued.","Wait and retry if rate-limited — QR generation is throttled per client.","If the client_id was revoked, update it in src/window/Config/pages/Backup/utils/aliyun.jsx (or the app needs an update with a new app registration).","Check pot-app issue trackers — a revoked client_id affects all users and is fixed in releases."],"exampleFix":null,"handlingStrategy":"retry","validationCode":"if (!navigator.onLine) {\n  throw new Error('offline: cannot start alipan QR login');\n}\n// throttle user-triggered login attempts:\nconst canStartLogin = (lastAttempt) => Date.now() - lastAttempt > 10_000;","typeGuard":"function isQrCodeResult(data) {\n  return data != null && typeof data === 'object' && typeof data['qrCodeUrl'] === 'string' && typeof data['sid'] === 'string';\n}","tryCatchPattern":"try {\n  const { url, sid } = await qrcode();\n} catch (e) {\n  if (String(e.message).startsWith('Can not find qrCodeUrl')) {\n    showLoginUnavailableMessage(); // client_id revoked or throttled; suggest app update\n  } else {\n    throw e;\n  }\n}","preventionTips":["Throttle QR login attempts — alipan rate-limits QR generation","Keep the app updated: an embedded client_id can be revoked server-side and fixed in releases","Validate qrCodeUrl and sid exist before rendering the QR (guard against schema drift)","Check pot-app release notes / issues if QR login suddenly fails for everyone"],"tags":["oauth","qrcode","aliyun-drive","client-id"],"backgroundTag":"oauth-device-flow-rejected","analyzedSha":"594d32ede96acd106b0256deaa8bb440ffcdff40","analyzedAt":"2026-09-02T18:12:21.811Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-09T21:17:11.164Z"}