Skip to main content

Manage Login Methods

CloudBase provides multiple identity authentication methods. You can flexibly configure them according to your business needs.

Enable login methods on the console

First, navigate to CloudBase/Authentication/Login Methods to choose the required login method.

Enabling Login Methods via SDK

Supports management of enabling and disabling login methods via Tencent Cloud SDK (tencentcloud-sdk), and supports multiple languages such as Java, Go, JavaScript.

Tip

Enabling/disabling login methods via the Tencent Cloud SDK (tencentcloud-sdk) only activates the CloudBase Platform Login Authentication v2 login methods and does not synchronize the enabling/disabling of the legacy CloudBase Console v1 login methods. To enable/disable v1 login methods, navigate to the CloudBase Console and perform the operation manually.

Supported login methods and parameters:

Login MethodsParametersParameter Values
Mobile Phone Verification Code LoginPhoneNumberLoginTRUE, FALSE; TRUE represents enable, FALSE represents disable
Anonymous LoginAnonymousLoginTRUE, FALSE; TRUE represents enable, FALSE represents disable
Username and Password LoginUsernameLoginTRUE, FALSE; TRUE represents enable, FALSE represents disable
{
"EnvId": "your-env-id",
"PhoneNumberLogin": "TRUE",
"AnonymousLogin": "TRUE",
"UsernameLogin": "TRUE"
}

Sample code is provided below. To learn more about usage, visit Tencent Cloud API:

const tencentcloud = require("tencentcloud-sdk-nodejs-tcb");
const TcbClient = tencentcloud.tcb.v20180608.Client;

// Instantiate an authentication object. The input parameters need to include Tencent Cloud account SecretId and SecretKey. Pay attention to keeping the confidentiality of the key pair.
// Code leakage may lead to the leakage of SecretId and SecretKey, threatening the security of all resources under the account. The following sample code is for reference only. It is recommended to use keys in a more secure way. See https://cloud.tencent.com/document/product/1278/85305.
// The key can be obtained at the official console https://console.cloud.tencent.com/cam/capi.
const clientConfig = {
credential: {
secretId: "",
secretKey: "",
},
region: "",
profile: {
httpProfile: {
endpoint: "tcb.tencentcloudapi.com",
},
},
};

// Instantiate a client object for the product to be requested; clientProfile is optional.
const client = new TcbClient(clientConfig);
const params = {};
client.EditAuthConfig(params).then(
(data) => {
console.log(data);
},
(err) => {
console.error("error", err);
}
);