This topic describes how to initialize ApsaraVideo Media Processing (MPS) SDK for Node.js by using an AccessKey pair or a Security Token Service (STS) token.
Prerequisites
- An Alibaba Cloud account is created. Real-name verification is complete. MPS is activated.
- The AccessKey pair used to access MPS is prepared. You can create an AccessKey pair of your Alibaba Cloud account on the Security Management page. Alternatively, you can create a RAM user in the Resource Access Management (RAM) console and grant the RAM user the permissions on MPS. For more information, see Grant permissions to a RAM user.
Procedure
- Use an AccessKey pair to initialize the SDK. Sample code:
var RPCClient = require('@alicloud/pop-core').RPCClient; function initMtsClient(accessKeyId, accessKeySecret,regionId) { var client = new RPCClient({ accessKeyId: accessKeyId, accessKeySecret: accessKeySecret, endpoint: 'http://mts.' + regionId + '.aliyuncs.com', apiVersion: '2014-06-18' }); return client; }
- Use an STS token to initialize the SDK. Sample code:
var RPCClient = require('@alicloud/pop-core').RPCClient; function initMtsClient(accessKeyId, accessKeySecret, securityToken,regionId) { var client = new RPCClient({ accessKeyId: accessKeyId, accessKeySecret: accessKeySecret, securityToken: securityToken, endpoint: 'http://mts.' + regionId + '.aliyuncs.com', apiVersion: '2014-06-18' }); return client; }