security - Azure Event Hubs: How to grant SAS tokens to Javascript publishers (running in browser)? -


i building website analytics solution based on azure event hubs. have javascript code embedded in each web page publishes events directly event hub via azure event hubs rest api.

the rest api requires each call authenticated via sas token. questions - have code server side endpoint provide publishers temporary tokens before can start publishing?

are there alternative approaches?

  1. does rest api provide "authenticate" end point out of box? (couldn't find here)
  2. or, how terrible, security wise have token hard coded client-side code?
  3. or, technically feasible security-wise worse option 2, hard-code event hub's shared access key in client-side code , use (unofficial) azure servicebus javascript sdk generate sas token on fly?

event hub rest api not provide authentication end point. have code generation of sas tokens per client (browser or device) on server side (may part of authn/z routines?). refer reddog.servicebus nuget package generate sas tokens event hub, per client. article on iot, explains authenticating against event hubs using aforementioned package.

in opinion, rather above , rule out #2 , #3. (2 & 3) leave solution vulnerable , violate best practices.


Comments

Popular posts from this blog

javascript - jQuery: Add class depending on URL in the best way -

caching - How to check if a url path exists in the service worker cache -

Redirect to a HTTPS version using .htaccess -