wbamberg Example of the webRequest.onAuthRequired API (#206)
* Example of the webRequest.onAuthRequired API

* Update README, add applications.id to manifest
Latest commit 5dd59a4 Apr 14, 2017



Although this add-on uses a stored password to authenticate to a web server, it should not be taken as an example of how to store or work securely with passwords. It's only a demonstration of how to use the webRequest.onAuthRequired API.

This add-on uses the webRequest.onAuthRequired API to log the user into the demo site at https://httpbin.org/basic-auth/user/passwd using a stored username and password.

This add-on stores a username and password using the storage.local API. The default value is the correct value for the demo site:

username: "user"
password: "passwd"

You can change the default values in the add-on's options page.

The add-on then uses webRequest.onAuthRequired to intercept authentication requests from the demo site. When it gets such a request, it fetches the stored credentials and supplies them asynchronously.

To try out the add-on: