Skip to content
This repository was archived by the owner on Apr 15, 2026. It is now read-only.

Latest commit

 

History

History

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 
 
 

README.md

Tencent CloudBase Framework MP Plugin

Tencent CloudBase Framework Auth Plugin

Github License Npm version issue PRs Welcome star

云开发 CloudBase Framework 框架「登录配置」插件: 通过云开发 CloudBase Framework 框架一键设置环境下的登录配置。

功能特性

  • 支持未登录、匿名登录登录设置
  • 后续会支持开放平台、公众号、账号密码等其他登录方式配置

使用方法

步骤一. 准备工作

具体步骤请参照 准备云开发环境和 CloudBase CLI 命令工具

步骤二. 编写 cloudbaserc.json 配置

framework.plugins 中新增登录插件配置

{
  "envId": "YOU_ENV_ID",
  "framework": {
    "plugins": {
      "auth": {
        "use": "@cloudbase/framework-plugin-auth",
        "inputs": {
          "configs": [
            {
              "platform": "NONLOGIN",
              "status": "ENABLE"
            }
          ]
        }
      }
    }
  }
}

具体配置信息请参考下面的配置文档

步骤三. 一键部署

cloudbase framework deploy

配置

默认情况下仅需要配置 appidprivateKeyPath 即可使用,以下配置参数针对有特殊需求的场景

配置示例

云开发的配置文件 cloudbaserc.json,可在配置文件的 plugins 里修改和写入插件配置

{
  "envId": "YOU_ENV_ID",
  "framework": {
    "plugins": {
      "client": {
        "use": "@cloudbase/framework-plugin-auth",
        "inputs": {
          "configs": [
            {
              "platform": "NONLOGIN",
              "status": "ENABLE"
            }
          ]
        }
      }
    }
  }
}

配置参数说明

configs

必填,类型为数组格式 Array.<Login 对象>

Login 对象

属性名称 类型 长度 是否必填 描述
platform String 1-32 平台名称,可枚举值:
WECHAT-OPEN:微信开放平台;
WECHAT-PUBLIC:微信公众平台;
QQ-MINI:QQ 小程序;
CUSTOM:自定义登录;
ANONYMOUS:匿名登录;
EMAIL:邮箱登录;
NONLOGIN:未登录
目前仅支持 ANONYMOUS 和 NONLOGIN
status String 1-32 默认开启,可枚举值:ENABLE;DISABLE。
platformId String 1-64 第三方平台的 AppID
platformSecret String 1-64 第三方平台的 AppSecret

更多插件

请访问 CloudBase Framework 插件列表 搭配使用其他插件

文档资料