tcloud-apigw-app-auth-sign

1.2.0 • Public • Published

tcloud-apigw-app-auth-sign

install

npm install tcloud-apigw-app-auth-sign

Getting started

get request

const appAuthSign = require('tcloud-apigw-app-auth-sign')
const headers = appAuthSign.signHeader({
	apiAppKey: 'key',
	apiAppSecret: 'S%$^k932DASF',
	method: 'GET',
	url: '/api/getUser',
    params: {userId: 8},
	headers: {
		accept: 'application/json',
		'x-date': new Date().toUTCString()
		'Content-Type': 'application/json'
	},
	debug: true,
})

console.log(headers.Authorization)
console.log(headers['Content-MD5'])

post request

const appAuthSign = require('tcloud-apigw-app-auth-sign')
const headers = appAuthSign.signHeader({
	apiAppKey: 'key',
	apiAppSecret: 'S%$^k932DASF',
	method: 'POST',
	url: '/api/createPost',
    data: { content: 'some news', author: 'David'},
	headers: {
		accept: 'application/json',
		'x-date': new Date().toUTCString()
		'Content-Type': 'application/json'
	},
	debug: true,
})

console.log(headers.Authorization)
console.log(headers['Content-MD5'])

Variations

License

MIT.

Versions

Current Tags

  • Version
    Downloads (Last 7 Days)
    • Tag
  • 1.2.0
    3
    • latest

Version History

  • Version
    Downloads (Last 7 Days)
    • Published
  • 1.2.0
    3
  • 1.1.0
    0
  • 1.0.0
    0

Package Sidebar

Install

npm i tcloud-apigw-app-auth-sign

Weekly Downloads

3

Version

1.2.0

License

mit

Unpacked Size

290 kB

Total Files

6

Last publish

Collaborators

  • zhongxingdou