Merge pull request #433 from wunter8/auth-query-param-docs

docs for auth query param
This commit is contained in:
Philipp C. Heckel 2022-10-09 08:55:47 -04:00 committed by GitHub
commit 24940f8a3b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 21 additions and 0 deletions

View File

@ -2678,6 +2678,27 @@ Here's a simple example:
]));
```
#### Auth Query Param
In some instances, you may want to send auth credentials in the URL (e.g., a GET webhook or a JSON POST request). You
can use the `auth` query parameter. Set the value to the base64 encoding of the value of the `Authorization` header
and strip any trailing `=`. **Be sure to only send auth credentials over an HTTPS connection**
Here is an example:
```
Step 1. base64(user:pass) -> base64(testuser:fakepassword) -> dGVzdHVzZXI6ZmFrZXBhc3N3b3Jk
Step 2. Authorization header -> Basic base64(testuser:fakepassword) -> Basic dGVzdHVzZXI6ZmFrZXBhc3N3b3Jk
Step 3. base64(Authorization header) -> base64(Basic dGVzdHVzZXI6ZmFrZXBhc3N3b3Jk) -> QmFzaWMgZEdWemRIVnpaWEk2Wm1GclpYQmhjM04zYjNKaw==
Step 4. remove trailing `=` (if any) -> QmFzaWMgZEdWemRIVnpaWEk2Wm1GclpYQmhjM04zYjNKaw== -> QmFzaWMgZEdWemRIVnpaWEk2Wm1GclpYQmhjM04zYjNKaw
Step 5. add query param to URL -> https://ntfy.sh/topic -> https://ntfy.sh/topic?auth=QmFzaWMgZEdWemRIVnpaWEk2Wm1GclpYQmhjM04zYjNKaw
```
!!! note
Do NOT remove trailing `=` after step 2
The following command will generate the appropriate value for you on *nix systems:
```echo -n "Basic `echo -n 'testuser:fakepassword' | base64`" | base64 | tr -d '='```
### Message caching
!!! info
If `Cache: no` is used, messages will only be delivered to connected subscribers, and won't be re-delivered if a