egg-aliyun-auth-helper

1.0.5 • Public • Published

egg-aliyun-auth-helper

NPM version build status Test coverage David deps Known Vulnerabilities npm download

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.

License

MIT

Package Sidebar

Install

npm i egg-aliyun-auth-helper

Weekly Downloads

1

Version

1.0.5

License

MIT

Unpacked Size

8.95 kB

Total Files

7

Last publish

Collaborators

  • xxddqq123