alvarcarto / url-to-pdf-api

Web page PDF/PNG rendering done right. Self-hosted service for rendering receipts, invoices, or any content.
MIT License
7.03k stars 779 forks source link

API key authentication #41

Closed raquelxmoss closed 7 years ago

raquelxmoss commented 7 years ago

Hi folks! Could someone please point me to some documentation on how to do API key authentication. There's mention of it in the README, but no instructions yet, and I didn't see anything relevant in the Puppeteer docs. Any help appreciated!

kimmobrunfeldt commented 7 years ago

Hi!

You can enable a simple token authentication by setting API_TOKENS environment variable to anything. It is meant to be a comma-separated list of acceptable tokens in plain text. So e.g. API_TOKENS=token1,token2 npm start should then require x-api-key: token1 or x-api-key: token2 header.

raquelxmoss commented 7 years ago

Thanks for the speedy response 😄 I'll give that a go