tcloud-apigw-app-auth-sign
v1.2.0
Published
## install npm install tcloud-apigw-app-auth-sign
Downloads
1
Readme
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.