0.0.46 • Published 2 years ago

azure-sas-token v0.0.46

Weekly downloads
3
License
ISC
Repository
github
Last release
2 years ago

Azure SAS token generator

A simple JavaScript Azure SAS token generator

The current project is about how to programmatically generate a Shared Access Signature (SAS) token to use with Postman in order to post messages to Azure Service Bus Topic/Queue.

NPM GitHub issues Snyk Vulnerabilities for npm package npm npm bundle size npm bundle size npm GitHub deployments HitCount

Motivation

After googling for a while in order to generate the necessary token, to post messages to Azure service bus, I noticed that there is no clear explanations, how to achieve it in JavaScript!! I'm proud to offer you a simple JS way to generate Azure SAS token - using node - or angular.

Features

azure sas token generation in node Don't forget to let me a Star :-)

Installation

npm install azure-sas-token

Code Example

js-standard-style

import { createSharedAccessToken } from 'azure-sas-token';

// default token validity is 7 days
let sasToken = createSharedAccessToken('https://<service namespace>.servicebus.windows.net/<topic name or queue>',
								'<signature key name>',
								'<signature hash>');
console.log(`sasToken: ${sasToken}`);

// Specify your own validity in secs, two hours in this example
sasToken = createSharedAccessToken('https://<service namespace>.servicebus.windows.net/<topic name or queue>',
								'<signature key name>',
								'<signature hash>', 
								60 * 60 * 2);
console.log(`sasToken: ${sasToken}`);

Posting messages in Azure service-bus queue - tutorial

https://github.com/ah584d/azure-send-message-to-service-bus-with-postman

POST https://<yournamespace>.servicebus.windows.net/<yourentity>/messages
Content-Type: application/json
Authorization: SharedAccessSignature sr=https%3A%2F%2F<yournamespace>.servicebus.windows.net%2F<yourentity>&sig=<your token generated by this repository code>&se=1438205742&skn=KeyName

Tests

Done!

Build status

GitHub deployments

contributions welcome

Credits

The only related topic that I founded on Microsoft Azure help

https://docs.microsoft.com/en-us/rest/api/eventhub/generate-sas-token

Icon from: http://www.kameleon.pics

License

A short snippet describing the license (MIT, Apache etc)

MIT © Avraham Hamu

0.0.44

2 years ago

0.0.45

2 years ago

0.0.46

2 years ago

0.0.41

4 years ago

0.0.42

4 years ago

0.0.43

4 years ago

0.0.40

4 years ago

0.0.37

4 years ago

0.0.38

4 years ago

0.0.39

4 years ago

0.0.36

4 years ago

0.0.35

4 years ago

0.0.33

4 years ago

0.0.34

4 years ago

0.0.32

4 years ago

0.0.30

4 years ago

0.0.31

4 years ago

0.0.29

4 years ago

0.0.27

4 years ago

0.0.28

4 years ago

0.0.26

4 years ago

0.0.25

4 years ago

0.0.24

4 years ago

0.0.23

4 years ago

0.0.22

4 years ago

0.0.21

4 years ago

0.0.20

4 years ago

0.0.17

4 years ago

0.0.18

4 years ago

0.0.19

4 years ago

0.0.12

4 years ago

0.0.13

4 years ago

0.0.14

4 years ago

0.0.15

4 years ago

0.0.16

4 years ago

0.0.11

4 years ago

0.0.10

4 years ago

0.0.9

4 years ago

0.0.8

4 years ago

0.0.7

4 years ago

0.0.5

4 years ago

0.0.6

4 years ago

0.0.4

4 years ago

0.0.3

4 years ago

0.0.2

4 years ago

0.0.1

4 years ago