Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork9.6k
Description
Symfony version(s) affected
7.1.3
Description
With self-hosted Ntfy (v 2.11.0):
- sending notification with Ntfy Notifier with username and password in DSN results in unauthorized error.
- Also I don't know way how to set DSN to use token (Bearer auth) without reading transport source.
- README uses keyword URL but this is not used in example DSN (instead there is "default")
How to reproduce
Set DSN by README.md (including username and password) with authorized topic and try to send notification.
Possible Solution
Problem no.1 is in bad formatted Basic authentication header. It is created in NtfyTransport.php, line 90$headers['Authorization'] = 'Basic '.rtrim(base64_encode($this->user.':'.$this->password), '=');
should be:$headers['Authorization'] = 'Basic '.base64_encode($this->user.':'.$this->password);
Problem is in removing=
from string.
Problem no.2:
In NtfyTransport.php on line 91 is condition for use token:} elseif (null !== $this->password) {
which in fact is satisfied when$this->user
is null. Solution is to add second DSN example to README for use token:NTFY_DSN=ntfy://[:TOKEN]@default[:PORT]/TOPIC?[secureHttp=[on]]
Additional Context
No response