npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

qq-login-qrcode

v2.0.0

Published

基于 node.js 开发的 QQ 扫码登录模块,支持 TypeScript,提供完整的类型定义和简洁的 API

Readme

QQ-Login-Qrcode

基于 node.js 开发的 QQ 扫码登录模块,支持 TypeScript,提供完整的类型定义和简洁的 API

特性

  • ✅ 支持 TypeScript,提供完整的类型定义
  • ✅ 支持 CommonJS 和 ESM 模块
  • ✅ 简单易用的 API,只需两个函数即可完成登录流程
  • ✅ 基于 axios 的网络请求,稳定可靠
  • ✅ 详细的 JSDoc 文档,便于使用和维护
  • ✅ 支持自定义 appid 和重定向 URL

安装

$ npm install qq-login-qrcode
$ pnpm add qq-login-qrcode
$ yarn add qq-login-qrcode

示例

JavaScript 示例

const { generateQrCode, checkLoginStatus } = require('qq-login-qrcode');

// 获取二维码
async function login() {
  try {
    // 获取二维码和 qrsig
    const qrResult = await generateQrCode();
    console.log('qrsig:', qrResult.qrsig);
    console.log('二维码图片:', qrResult.image);

    // 轮询登录状态
    setInterval(async () => {
      const loginResult = await checkLoginStatus(qrResult.qrsig);
      console.log('登录状态:', loginResult);

      if (loginResult.code === 0) {
        console.log('登录成功!');
        console.log('Cookies:', loginResult.cookies);
        console.log('UIN:', loginResult.uin);
        clearInterval(this);
      }
    }, 2000);
  } catch (error) {
    console.error('登录失败:', error);
  }
}

login();

TypeScript 示例

import { checkLoginStatus, generateQrCode, LoginResult, QrCodeResult } from 'qq-login-qrcode';

// 获取二维码
async function login() {
  try {
    // 获取二维码和 qrsig
    const qrResult: QrCodeResult = await generateQrCode();
    console.log('qrsig:', qrResult.qrsig);
    console.log('二维码图片:', qrResult.image);

    // 轮询登录状态
    const interval = setInterval(async () => {
      const loginResult: LoginResult = await checkLoginStatus(qrResult.qrsig);
      console.log('登录状态:', loginResult);

      if (loginResult.code === 0) {
        console.log('登录成功!');
        console.log('Cookies:', loginResult.cookies);
        console.log('UIN:', loginResult.uin);
        clearInterval(interval);
      }
    }, 2000);
  } catch (error) {
    console.error('登录失败:', error);
  }
}

login();

API

generateQrCode(appid, redirectUrl)

获取登录二维码和 qrsig

参数

  • appid (可选): QQ 互联提供的 appid,默认为 715030901(QQ 群网页管理)
  • redirectUrl (可选): 登录成功后的回调地址,默认为 https://qun.qq.com/

返回值

  • qrsig: 用于后续查询登录状态的标识
  • image: 二维码图片的 base64 编码

checkLoginStatus(qrsig, appid, redirectUrl)

查询登录状态并获取 cookies

参数

  • qrsig: 从 generateQrCode 获取的 qrsig
  • appid (可选): QQ 互联提供的 appid,默认为 715030901
  • redirectUrl (可选): 登录成功后的回调地址,默认为 https://qun.qq.com/

返回值

  • code: 状态码
  • msg: 状态描述
  • uin (可选): QQ 号(登录成功时返回)
  • cookies (可选): 登录成功时返回的 cookies

状态码说明

  • 65: 登录二维码已失效
  • 66: 请使用手机 QQ 扫码登录
  • 67: 正在验证二维码
  • 0: 登录成功

构建和开发

构建项目

$ pnpm build

开发模式

$ pnpm dev

代码检查

$ pnpm lint

类型检查

$ pnpm typecheck

许可证

MIT