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

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;
    }