

ocr.ap-shanghai.tencentcloudapi.com is to access the Shanghai access point. The public parameter Region determines the region where the business resources are located. For example, Region=ap-beijing is to operate resources in the Beijing region. If the domain name does not specify region information, it will by default connect to a nearby access point. Proximity access may have problems. If no IP can be resolved, it will by default access the Guangzhou region. Additionally, the domain name region and the public parameter Region may differ, but this may increase latency. It is advisable to select the same region for the domain name and the public parameter Region: South China (Guangzhou), ap-guangzhou.

const tencentcloud = require("../../../../tencentcloud-sdk-nodejs");const OcrClient = tencentcloud.ocr.v20181119.Client;const models = tencentcloud.ocr.v20181119.Models;const Credential = tencentcloud.common.Credential;const ClientProfile = tencentcloud.common.ClientProfile;const HttpProfile = tencentcloud.common.HttpProfile;let cred = new Credential(" SecretId ", " SecretKey ");let httpProfile = new HttpProfile();let clientProfile = new ClientProfile();/*Recommended to use V3 authentication. When the content exceeds 1M, signature authentication using V3 must be used. Except for Node SDK, other language SDKs support V3.clientProfile.signMethod = "TC3-HMAC-SHA256";*/clientProfile.httpProfile = httpProfile;let client = new OcrClient(cred, "ap-guangzhou", clientProfile);let req = new models.IDCardOCRRequest();req.ImageUrl = "[https://test.jpg](https://test.jpg/)";req.CardSide = "FRONT";let config = {"CropPortrait":true};req.Config = JSON.stringify(config)client.IDCardOCR(req, function(errMsg, response) {if (errMsg) {console.log(errMsg);return;}console.log(response.to_json_string());});
data:image/jpg;base64, and line break \\n when converting images/videos to Base64.[TencentCloudSDKException]message:AuthFailure.SignatureFailure-The provided credentialscould not be validated because of exceeding request size limit, please use new signaturemethod `TC3-HMAC-SHA256`. requestId:719970d4-5814-4dd9-9757-a3f11ecc9b20
clientProfile.setSignMethod("TC3-HMAC-SHA256"); // Specify the signature algorithm (default is HmacSHA256)

Feedback