efixler / scrape

Web Scraping Service
Mozilla Public License 2.0
6 stars 4 forks source link

Auth middleware #23

Closed efixler closed 5 months ago

efixler commented 5 months ago

This PR enables the first iteration of JWT-based authorization to scrape endpoints, via a new middleware.

I'll skip most the usual PR info here in favor of linking to the documentation updates that step through the process of using authorization and details about how authorization is granted.

Steps to Test

To test this PR, first follow the steps in the docs, and then issue a request like this:

POST http://localhost:8080/extract
Content-Type: application/json
Authorization: Bearer PUT_YOUR_TOKEN_HERE

{
    "url": "https://road.cc/content/tech-news/zipps-new-tyres-ensure-safe-retention-hookless-rims-308387",
    "pp": true
}

Also, try it without a token or with a bad token once you've enabled auth.