Skip to main content

Login Authentication Plugin

Tencent CloudBase Framework MP Plugin

Tencent CloudBase Framework Auth Plugin

Github License Npm version issue PRs Welcome star star

CloudBase Framework Login Configuration Plugin: Through the CloudBase Framework, set up login configuration in the environment with one click.

Features

  • Supports unauthenticated access, anonymous login, and login settings
  • Will support configuration for Open Platform, Official Account, username/password, and other login methods

Usage

Step 1. Preparations

Specific steps please refer to Preparing the Cloud Development Environment and CloudBase CLI Command Tool

Step 2. Write cloudbaserc.json configuration

Add login plugin configuration in framework.plugins.

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

Please refer to the configuration document below for specific configuration information.

Step 3. One-Click Deployment

cloudbase framework deploy

Configuration

By default, only appid and privateKeyPath need to be configured for use. The following configuration parameters are for scenarios with specific requirements.

Configuration Example

The Cloud Development configuration file cloudbaserc.json allows modifying and writing plugin configurations in the plugins section.

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

Configuration Parameters Description

configs

Required. The type is an array format: Array.<Login Object>

Login Object

Property NameTypeLengthRequiredDescription
platformString1-32RequiredPlatform name, enumerable values:<br>WECHAT-OPEN: WeChat Open Platform;<br>WECHAT-PUBLIC: WeChat Public Platform;<br>QQ-MINI: QQ Mini Program;<br>CUSTOM: Custom Login;<br>ANONYMOUS: Anonymous Login;<br>EMAIL: Email Login;<br>NONLOGIN: Non-login<br>Currently only ANONYMOUS and NONLOGIN are supported
statusString1-32NoEnabled by default, enumerable values: ENABLE; DISABLE.
platformIdString1-64OptionalAppID of the third-party platform
platformSecretString1-64OptionalAppSecret of the third-party platform

More Plugins

Please visit the CloudBase Framework Plugin List to use other plugins in combination

Documentation Resources