egg-aliyun-auth-helper
v1.0.5
Published
This is a helper to get auth for aliyun services
Downloads
25
Readme
egg-aliyun-auth-helper
Install
$ npm i egg-aliyun-auth-helper --save
Usage
// {app_root}/config/plugin.js
exports.aliyunAuthHelper = {
enable: true,
package: 'egg-aliyun-auth-helper'
};
Configuration
// {app_root}/config/config.default.js
exports.aliyunAuthHelper = {
accessKeyId: 'zxc',
accessKeySecret: 'zxc',
endpoint: 'https://aaaaa.aliyunc.com',
apiVersion: '2015-04-01',
bucket: 'kjashdkjas'
};
see config/config.default.js for more detail.
Example
async getAuthForAliyun() {
const { ctx, app } = this;
const roleSession = 'BrowserSingleUpload';
const roleAction = '"oss:PutObject"';
const data = {
roleSession,
roleAction
};
const result = await app.authHelper.getAuthForAliyun(data);
return result;
}
Questions & Suggestions
Please open an issue here.