微信扫码登录,支持获取应用列表、二维码、检查登录、获取 Token 与用户信息。
| 参数名 | 类型 | 必填 | 说明 | 示例 |
|---|---|---|---|---|
| action | string | 是 | 操作类: getApps(内置应用列表),getQrCode,checkLogin,getAccessToken,getUserInfo | getApps |
| type | string | 是 | 应用类型: app,web,(小程序|公众号|H5等后续增加) | web |
| appid | string | 是 | 应用appid | wx48db31d50e334801 |
| secret | string | 否 | 未知参数: 可选 (自行测试) | |
| redirect_uri | string | 否 | 类型为web 一般都要带上 | https://y.qq.com/n/ryqq/portal/index |
[
{
"name": "action",
"type": "string",
"required": true,
"description": "操作类: getApps(内置应用列表),getQrCode,checkLogin,getAccessToken,getUserInfo",
"example": "getApps"
},
{
"name": "type",
"type": "string",
"required": true,
"description": "应用类型: app,web,(小程序|公众号|H5等后续增加)",
"example": "web"
},
{
"name": "appid",
"type": "string",
"required": true,
"description": "应用appid",
"example": "wx48db31d50e334801"
},
{
"name": "secret",
"type": "string",
"required": false,
"description": "未知参数: 可选 (自行测试)",
"example": ""
},
{
"name": "redirect_uri",
"type": "string",
"required": false,
"description": "类型为web 一般都要带上",
"example": "https://y.qq.com/n/ryqq/portal/index"
}
]
{
"openapi": "3.1.1",
"info": {
"title": "Wechat-Scan-Login",
"description": "微信扫码登录,支持获取应用列表、二维码、检查登录、获取 Token 与用户信息。",
"version": "1.0.0"
},
"paths": {
"\/api\/wechat\/scan_login\/index.php": {
"get": {
"summary": "Wechat-Scan-Login",
"description": "微信扫码登录,支持获取应用列表、二维码、检查登录、获取 Token 与用户信息。",
"parameters": [
{
"name": "action",
"in": "query",
"required": true,
"schema": {
"type": "string",
"example": "getApps"
},
"description": "操作类: getApps(内置应用列表),getQrCode,checkLogin,getAccessToken,getUserInfo"
},
{
"name": "type",
"in": "query",
"required": true,
"schema": {
"type": "string",
"example": "web"
},
"description": "应用类型: app,web,(小程序|公众号|H5等后续增加)"
},
{
"name": "appid",
"in": "query",
"required": true,
"schema": {
"type": "string",
"example": "wx48db31d50e334801"
},
"description": "应用appid"
},
{
"name": "secret",
"in": "query",
"required": false,
"schema": {
"type": "string"
},
"description": "未知参数: 可选 (自行测试)"
},
{
"name": "redirect_uri",
"in": "query",
"required": false,
"schema": {
"type": "string",
"example": "https:\/\/y.qq.com\/n\/ryqq\/portal\/index"
},
"description": "类型为web 一般都要带上"
}
],
"responses": {
"200": {
"description": "成功",
"content": {
"application\/json": {
"schema": {
"type": "object"
}
}
}
}
}
},
"post": {
"summary": "Wechat-Scan-Login",
"description": "微信扫码登录,支持获取应用列表、二维码、检查登录、获取 Token 与用户信息。",
"parameters": [
{
"name": "action",
"in": "query",
"required": true,
"schema": {
"type": "string",
"example": "getApps"
},
"description": "操作类: getApps(内置应用列表),getQrCode,checkLogin,getAccessToken,getUserInfo"
},
{
"name": "type",
"in": "query",
"required": true,
"schema": {
"type": "string",
"example": "web"
},
"description": "应用类型: app,web,(小程序|公众号|H5等后续增加)"
},
{
"name": "appid",
"in": "query",
"required": true,
"schema": {
"type": "string",
"example": "wx48db31d50e334801"
},
"description": "应用appid"
},
{
"name": "secret",
"in": "query",
"required": false,
"schema": {
"type": "string"
},
"description": "未知参数: 可选 (自行测试)"
},
{
"name": "redirect_uri",
"in": "query",
"required": false,
"schema": {
"type": "string",
"example": "https:\/\/y.qq.com\/n\/ryqq\/portal\/index"
},
"description": "类型为web 一般都要带上"
}
],
"responses": {
"200": {
"description": "成功",
"content": {
"application\/json": {
"schema": {
"type": "object"
}
}
}
}
}
}
}
},
"servers": [
{
"url": "https:\/\/api.vsaa.cn",
"description": "当前访问入口(https)"
}
]
}
{
"code": 0,
"data": {
"uuid": "031usZkE1kcHFa12",
"appid": "wx48db31d50e334801",
"type": "web",
"qrcodeUrl": "https://open.weixin.qq.com/connect/qrcode/031usZkE1kcHFa12",
"redirect_uri": "https://y.qq.com/n/ryqq/portal/index",
"timestamp": 1788684465490
},
"message": "success"
}
Wechat-Scan-Login 接口用于通过微信扫码方式完成 Web 或 App 应用的登录授权流程。开发者调用该接口可获取二维码链接及授权状态,实现用户扫码登录功能。支持获取内置应用列表、生成二维码、查询登录状态及获取访问令牌等操作。
/api/wechat/scan_login/index.php
支持 GET 和 POST 方法。
本接口无需任何鉴权密钥。
| 参数名 | 类型 | 必填 | 说明 |
|---|---|---|---|
| action | string | 是 | 操作类型,可选值:getApps(获取内置应用列表)、getQrCode(获取二维码)、checkLogin(检查登录状态)、getAccessToken(获取访问令牌)、getUserInfo(获取用户信息) |
| type | string | 是 | 应用类型,可选值:app(App 应用)、web(Web 应用),小程序、公众号、H5 等后续增加 |
| appid | string | 是 | 微信开放平台分配的应用 AppID |
| secret | string | 否 | 预留参数,当前未使用,可留空 |
| redirect_uri | string | 否 | 授权回调地址,type 为 web 时建议填写,用于扫码授权后重定向返回 Code |
{
"code": 0,
"data": {
"uuid": "031usZkE1kcHFa12",
"appid": "wx48db31d50e334801",
"type": "web",
"qrcodeUrl": "https://open.weixin.qq.com/connect/qrcode/031usZkE1kcHFa12",
"redirect_uri": "https://y.qq.com/n/ryqq/portal/index",
"timestamp": 1788684465490
},
"message": "success"
}
| 字段 | 类型 | 说明 |
|---|---|---|
| code | integer | 状态码,0 表示成功 |
| message | string | 响应消息描述 |
| data | object | 业务数据对象 |
| data.uuid | string | 二维码唯一标识,用于后续轮询检查扫码状态 |
| data.appid | string | 微信应用 ID |
| data.type | string | 应用类型,枚举值:app、web |
| data.qrcodeUrl | string | 二维码跳转链接,用户扫码后访问此地址完成授权 |
| data.redirect_uri | string | 回调重定向地址,仅在 type 为 web 时生效 |
| data.timestamp | integer | 二维码生成时间戳(毫秒) |
{
"code": 1,
"msg": "请求过于频繁",
"errcode": 11005
}
| errcode | 含义 |
|---|---|
| 11001 | 未提供调用密钥 |
| 11002 | 密钥错误 |
| 11003 | 密钥已禁用 |
| 11004 | 积分余额不足 |
| 11005 | 请求过于频繁(QPM 限制) |
| 11006 | 接口维护中 |
| 11007 | 接口已禁用 |
| 11008 | 接口不可用 |
| 11009 | 密钥校验暂不可用 |
| 11010 | 积分系统暂不可用 |
| 11011 | 收费接口须提供有效密钥 |
| 11012 | 鉴权方式错误 |
| 11013 | 接口不存在 |
| 11014 | ***地址无效 |
| 11015 | ***地址不允许 |
| 11016 | ***请求失败 |
| 11017 | 服务暂不可用 |
| 11018 | 请求方式不允许 |
| 11019 | 当前IP不在白名单内 |
| 11020 | 启用出口代理须提供有效密钥 |
| 11021 | 未配置可用出口代理 |
| 11022 | 出口代理不可用 |
| 11023 | 密钥已过期 |
| 11024 | 令牌分配积分不足 |
curl -X POST "https://api.example.com/api/wechat/scan_login/index.php" \
-d "action=getQrCode&type=web&appid=wx48db31d50e334801&redirect_uri=https://example.com/callback"
appid 等参数,避免泄露至前端代码或公开仓库。action 参数决定操作流程,常见序列为 getApps → getQrCode → checkLogin → getAccessToken → getUserInfo,各步骤需按序调用,跳过检查步骤可能导致后续流程失败。type=web 时建议携带 redirect_uri,用于授权回调;未携带时微信可能返回默认跳转地址或校验失败。secret 为可选参数,当前版本用途未公开,非必填项可忽略。uuid 与 qrcodeUrl 需配合前端扫码组件展示,扫码完成后通过 action=checkLogin 轮询状态,轮询间隔建议不低于 1 秒,避免高频请求触发限流。code != 0 时,以 message 字段为准排查原因,常见错误包括 appid 无效、type 不匹配、二维码已过期等。curl -X POST '/api/wechat/scan_login/index.php' \
-H 'Content-Type: application/json' \
-d '{"action":"getQrCode","type":"web","appid":"wx48db31d50e334801","redirect_uri":"https://y.qq.com/n/ryqq/portal/index"}'
# 返回 code=0 表示成功
欢迎使用 万象数据API(以下简称“本平台”,域名为 api.vsaa.cn)。在使用本平台提供的任何接口、数据及相关服务之前,请您务必仔细阅读并充分理解本免责声明的全部内容。您对本平台任何服务的使用,均视为您已阅读、理解并同意本声明的全部条款。
最后更新日期:2026年10月6日