caronc / apprise

Apprise - Push Notifications that work with just about every platform!
https://hub.docker.com/r/caronc/apprise
BSD 2-Clause "Simplified" License
10.91k stars 384 forks source link

WARNING - Failed to send Nextcloud v21 notification:error=403. #1074

Closed ostasevych closed 2 months ago

ostasevych commented 4 months ago

Hi! I am trying to configure the nextcloud notification.

I've added app password and run the command:

apprise -vvvvv -t "title" -b "body" nclouds://master:XXXX-XXXX-XXXXX-XXXXX-XXXX@mydomain.tld/master

Getting the 403 error:

2024-03-04 00:57:01,371 - TRACE - Loaded language en
2024-03-04 00:57:01,372 - DEBUG - Language set to en
2024-03-04 00:57:01,511 - TRACE - Notification Plugin NotifyAppriseAPI loaded in 0.132021s
2024-03-04 00:57:01,513 - TRACE - Notification Plugin NotifyEnigma2 loaded in 0.000975s
2024-03-04 00:57:01,514 - TRACE - Notification Plugin NotifyRSyslog loaded in 0.001117s
2024-03-04 00:57:01,516 - TRACE - Notification Plugin NotifyStreamlabs loaded in 0.000991s
2024-03-04 00:57:01,517 - TRACE - Notification Plugin NotifyKavenegar loaded in 0.000916s
2024-03-04 00:57:01,519 - TRACE - Notification Plugin NotifyProwl loaded in 0.001329s
2024-03-04 00:57:01,521 - TRACE - Notification Plugin NotifyPushSafer loaded in 0.001299s
2024-03-04 00:57:01,525 - TRACE - Notification Plugin NotifyJoin loaded in 0.002630s
2024-03-04 00:57:01,526 - TRACE - Notification Plugin NotifyXML loaded in 0.000982s
2024-03-04 00:57:01,531 - TRACE - Notification Plugin NotifyLametric loaded in 0.003694s
2024-03-04 00:57:01,533 - TRACE - Notification Plugin NotifyNotifico loaded in 0.001223s
2024-03-04 00:57:01,534 - TRACE - Notification Plugin NotifyEmby loaded in 0.000893s
2024-03-04 00:57:01,537 - TRACE - Notification Plugin NotifyDiscord loaded in 0.002201s
2024-03-04 00:57:01,538 - TRACE - Notification Plugin NotifyServerChan loaded in 0.000793s
2024-03-04 00:57:01,539 - TRACE - Notification Plugin NotifyJSON loaded in 0.000800s
2024-03-04 00:57:01,541 - TRACE - Notification Plugin NotifyMQTT loaded in 0.001203s
2024-03-04 00:57:01,543 - TRACE - Notification Plugin NotifyNotifiarr loaded in 0.001584s
2024-03-04 00:57:01,544 - TRACE - Notification Plugin NotifyMattermost loaded in 0.000839s
2024-03-04 00:57:01,546 - TRACE - Notification Plugin NotifyWhatsApp loaded in 0.001781s
2024-03-04 00:57:01,548 - TRACE - Notification Plugin NotifyFaast loaded in 0.000721s
2024-03-04 00:57:01,549 - TRACE - Notification Plugin NotifyDapnet loaded in 0.000825s
2024-03-04 00:57:01,550 - TRACE - Notification Plugin NotifyIFTTT loaded in 0.000788s
2024-03-04 00:57:01,585 - TRACE - Notification Plugin NotifyFCM loaded in 0.034838s
2024-03-04 00:57:01,588 - TRACE - Notification Plugin NotifyGrowl loaded in 0.001287s
2024-03-04 00:57:01,657 - TRACE - Notification Plugin NotifyGnome loaded in 0.068949s
2024-03-04 00:57:01,660 - TRACE - Notification Plugin NotifyMSG91 loaded in 0.002376s
2024-03-04 00:57:01,662 - TRACE - Notification Plugin NotifyWindows loaded in 0.001283s
2024-03-04 00:57:01,667 - TRACE - Notification Plugin NotifyForm loaded in 0.004187s
2024-03-04 00:57:01,669 - TRACE - Notification Plugin NotifyThreema loaded in 0.000930s
2024-03-04 00:57:01,672 - TRACE - Notification Plugin NotifyTwist loaded in 0.002064s
2024-03-04 00:57:01,674 - TRACE - Notification Plugin NotifyOneSignal loaded in 0.001435s
2024-03-04 00:57:01,676 - TRACE - Notification Plugin NotifySinch loaded in 0.000948s
2024-03-04 00:57:01,677 - TRACE - Notification Plugin NotifyRyver loaded in 0.000911s
2024-03-04 00:57:01,679 - TRACE - Notification Plugin NotifyNextcloudTalk loaded in 0.000840s
2024-03-04 00:57:01,683 - TRACE - Notification Plugin NotifyZulip loaded in 0.003482s
2024-03-04 00:57:01,685 - TRACE - Notification Plugin NotifyOffice365 loaded in 0.000981s
2024-03-04 00:57:01,686 - TRACE - Notification Plugin NotifyPagerTree loaded in 0.000908s
2024-03-04 00:57:01,699 - TRACE - Notification Plugin NotifyDBus loaded in 0.012661s
2024-03-04 00:57:01,701 - TRACE - Notification Plugin NotifyBark loaded in 0.000950s
2024-03-04 00:57:01,703 - TRACE - Notification Plugin NotifyAprs loaded in 0.001399s
2024-03-04 00:57:01,706 - TRACE - Notification Plugin NotifyBulkSMS loaded in 0.002135s
2024-03-04 00:57:01,707 - TRACE - Notification Plugin NotifyParsePlatform loaded in 0.000894s
2024-03-04 00:57:01,709 - TRACE - Notification Plugin NotifyMailgun loaded in 0.001375s
2024-03-04 00:57:01,711 - TRACE - Notification Plugin NotifyVonage loaded in 0.000991s
2024-03-04 00:57:01,712 - TRACE - Notification Plugin NotifyOpsgenie loaded in 0.001034s
2024-03-04 00:57:01,714 - TRACE - Notification Plugin NotifyBurstSMS loaded in 0.000855s
2024-03-04 00:57:01,715 - TRACE - Notification Plugin NotifyPushDeer loaded in 0.000712s
2024-03-04 00:57:01,716 - TRACE - Notification Plugin NotifyNextcloud loaded in 0.000800s
2024-03-04 00:57:01,718 - TRACE - Notification Plugin NotifyReddit loaded in 0.000960s
2024-03-04 00:57:01,721 - TRACE - Notification Plugin NotifyPushMe loaded in 0.002963s
2024-03-04 00:57:01,724 - TRACE - Notification Plugin NotifyMessageBird loaded in 0.001212s
2024-03-04 00:57:01,725 - TRACE - Notification Plugin NotifySMTP2Go loaded in 0.000913s
2024-03-04 00:57:01,726 - TRACE - Notification Plugin NotifyTechulusPush loaded in 0.000746s
2024-03-04 00:57:01,728 - TRACE - Notification Plugin NotifyXBMC loaded in 0.000739s
2024-03-04 00:57:01,729 - TRACE - Notification Plugin NotifyTwilio loaded in 0.000742s
2024-03-04 00:57:01,730 - TRACE - Notification Plugin NotifyGuilded loaded in 0.000519s
2024-03-04 00:57:01,731 - TRACE - Notification Plugin NotifyMisskey loaded in 0.000715s
2024-03-04 00:57:01,747 - TRACE - Notification Plugin NotifySES loaded in 0.015902s
2024-03-04 00:57:01,749 - TRACE - Notification Plugin NotifyPushjet loaded in 0.000826s
2024-03-04 00:57:01,750 - TRACE - Notification Plugin NotifyD7Networks loaded in 0.000851s
2024-03-04 00:57:01,751 - TRACE - Notification Plugin NotifyPagerDuty loaded in 0.000919s
2024-03-04 00:57:01,754 - TRACE - Notification Plugin NotifyPushover loaded in 0.002170s
2024-03-04 00:57:01,759 - TRACE - Notification Plugin NotifySimplePush loaded in 0.004399s
2024-03-04 00:57:01,761 - TRACE - Notification Plugin NotifyVoipms loaded in 0.000873s
2024-03-04 00:57:01,788 - TRACE - Notification Plugin NotifyEmail loaded in 0.027341s
2024-03-04 00:57:01,790 - TRACE - Notification Plugin NotifyGoogleChat loaded in 0.000957s
2024-03-04 00:57:01,791 - TRACE - Notification Plugin NotifyBulkVS loaded in 0.000809s
2024-03-04 00:57:01,795 - TRACE - Notification Plugin NotifySlack loaded in 0.002959s
2024-03-04 00:57:01,796 - TRACE - Notification Plugin NotifyMacOSX loaded in 0.000822s
2024-03-04 00:57:01,800 - TRACE - Notification Plugin NotifySMSEagle loaded in 0.003009s
2024-03-04 00:57:01,801 - TRACE - Notification Plugin NotifyGotify loaded in 0.000906s
2024-03-04 00:57:01,803 - TRACE - Notification Plugin NotifySNS loaded in 0.001451s
2024-03-04 00:57:01,807 - TRACE - Notification Plugin NotifyPushy loaded in 0.002564s
2024-03-04 00:57:01,812 - TRACE - Notification Plugin NotifyMastodon loaded in 0.004338s
2024-03-04 00:57:01,813 - TRACE - Notification Plugin NotifySynology loaded in 0.001218s
2024-03-04 00:57:01,815 - TRACE - Notification Plugin NotifyWeComBot loaded in 0.000974s
2024-03-04 00:57:01,816 - TRACE - Notification Plugin NotifyPopcornNotify loaded in 0.000778s
2024-03-04 00:57:01,818 - TRACE - Notification Plugin NotifySMSManager loaded in 0.000897s
2024-03-04 00:57:01,855 - TRACE - Notification Plugin NotifyTwitter loaded in 0.036665s
2024-03-04 00:57:01,857 - TRACE - Notification Plugin NotifyNtfy loaded in 0.001628s
2024-03-04 00:57:01,859 - TRACE - Notification Plugin NotifyMSTeams loaded in 0.000969s
2024-03-04 00:57:01,862 - TRACE - Notification Plugin NotifyFlock loaded in 0.002798s
2024-03-04 00:57:01,864 - TRACE - Notification Plugin NotifyPushBullet loaded in 0.000900s
2024-03-04 00:57:01,866 - TRACE - Notification Plugin NotifyNotica loaded in 0.001482s
2024-03-04 00:57:01,871 - TRACE - Notification Plugin NotifyHttpSMS loaded in 0.004075s
2024-03-04 00:57:01,872 - TRACE - Notification Plugin NotifyClickSend loaded in 0.000835s
2024-03-04 00:57:01,878 - TRACE - Notification Plugin NotifyPushed loaded in 0.001651s
2024-03-04 00:57:01,880 - TRACE - Notification Plugin NotifyKumulos loaded in 0.000794s
2024-03-04 00:57:01,885 - TRACE - Notification Plugin NotifyMatrix loaded in 0.004919s
2024-03-04 00:57:01,910 - TRACE - Notification Plugin NotifyTelegram loaded in 0.024478s
2024-03-04 00:57:01,912 - TRACE - Notification Plugin NotifyHomeAssistant loaded in 0.000884s
2024-03-04 00:57:01,914 - TRACE - Notification Plugin NotifyRocketChat loaded in 0.001889s
2024-03-04 00:57:01,917 - TRACE - Notification Plugin NotifySignalAPI loaded in 0.002235s
2024-03-04 00:57:01,919 - TRACE - Notification Plugin NotifySendGrid loaded in 0.000939s
2024-03-04 00:57:01,920 - TRACE - Notification Plugin NotifySyslog loaded in 0.000962s
2024-03-04 00:57:01,922 - TRACE - Notification Plugin NotifyDingTalk loaded in 0.000849s
2024-03-04 00:57:01,923 - TRACE - Notification Plugin NotifyWebexTeams loaded in 0.000729s
2024-03-04 00:57:01,926 - TRACE - Notification Plugin NotifySparkPost loaded in 0.002851s
2024-03-04 00:57:01,929 - TRACE - Notification Plugin NotifyBoxcar loaded in 0.002582s
2024-03-04 00:57:01,931 - TRACE - Notification Plugin NotifyLine loaded in 0.000916s
2024-03-04 00:57:01,931 - DEBUG - Notification Plugin 100(s) and 141 Schema(s) loaded in 0.5529s
2024-03-04 00:57:01,932 - TRACE - Nextcloud URL nclouds://master:XXXX-XXXX-XXXXX-XXXXX-XXXX@mydomain.tld/master unpacked as:
user="master"
password="XXXX-XXXX-XXXXX-XXXXX-XXXX"
port="None"
host="mydomain.tld"
fullpath="/master"
path="/"
query="master"
schema="nclouds"
url="nclouds://master:XXXX-XXXX-XXXXX-XXXXX-XXXX@mydomain.tld/master"
qsd="{}"
qsd+="{}"
qsd-="{}"
qsd:="{}"
secure="True"
verify="True"
targets="['master']"
headers="{}"
2024-03-04 00:57:01,936 - DEBUG - Loaded Nextcloud URL: nclouds://master:****@mydomain.tld/master?version=21&format=text&overflow=upstream&rto=4.0&cto=4.0&verify=yes
2024-03-04 00:57:01,937 - DEBUG - Nextcloud v21 POST URL: https://mydomain.tld//ocs/v2.php/apps/notifications/api/v2/admin_notifications/master (cert_verify=True)
2024-03-04 00:57:01,937 - DEBUG - Nextcloud v21 Payload: {'shortMessage': 'title', 'longMessage': 'body'}
2024-03-04 00:57:02,193 - WARNING - Failed to send Nextcloud v21 notification:error=403.
2024-03-04 00:57:02,194 - DEBUG - Response Details:
b''

What may be wrong?

caronc commented 4 months ago

Error 403 (Forbidden) generally implies you either put the wrong user/password in.

If your password contains a lot of mixed characters, you could try putting it on the URL instead such as:

The other alternative is to escape your special characters (see here)

ostasevych commented 4 months ago

Error 403 (Forbidden) generally implies you either put the wrong user/password in.

If your password contains a lot of mixed characters, you could try putting it on the URL instead such as:

  • nclouds://mydomain.tld/master?user=myaccount&password=mypassword

The other alternative is to escape your special characters (see here)

the thing is that the password is generated by the nextcloud itself, so it consists of several digits of ABC symbols split by "-". Nothing else.

caronc commented 3 months ago

Looking through the documentation that is part of the NextCloud library, i don't see anything out of the ordinary. Does your master user have admin privileges?

ostasevych commented 3 months ago

Looking through the documentation that is part of the NextCloud library, i don't see anything out of the ordinary. Does your master user have admin privileges?

yes, it has, however specifically this account is disabled now. Should it be active in order the service can work?

idominiki commented 2 months ago

Same problem here, while using apprise within uptime-kuma

2024-01-26T16:14:11+01:00 [MONITOR] ERROR: Cannot send notification to Nextcloud Talk
Error: Process exited with code 1
    at ChildProcess.done (/app/node_modules/promisify-child-process/index.cjs:70:19)
    at ChildProcess.emit (node:events:517:28)
    at maybeClose (node:internal/child_process:1098:16)
    at ChildProcess._handle.onexit (node:internal/child_process:303:5) {
  code: 1,
  signal: null,
  stdout: '2024-01-26 16:14:11,238 - WARNING - Failed to send Nextcloud Talk notification:error=403.\n',
  stderr: ''
}

Authentication is working as Nextcloud shows activity for App password

caronc commented 2 months ago

I had a look here and it says the following: image

Seems that the topic is read-only, is that possible?

idominiki commented 2 months ago

Sorry @caronc .. this was the problem.. Thanks!!!

caronc commented 2 months ago

I'll leave this ticket open. I can improve on the error message being displayed to make this kind of thing more obvious in the future

ostasevych commented 2 months ago

I have checked with another user, trying to send a notification to myself. The command was executed on the webserver directly.

apprise -vvvvv -t "title" -b "body" nclouds://myuser:ABCD-EFG-HIJ-KLM@my.local/myuser

Getting the same error.

This is what I see in /var/log/apache2/nextcloud.access file:

***.***.***.*** - myuser [16/Apr/2024:00:56:27 +0300] "GET /ocs/v2.php/apps/notifications/api/v2/notifications?format=json HTTP/1.1" 304 3076 "-" "Mozilla/5.0 (Windows) mirall/3.12.3stable-Win64 (build 20240328) (Nextcloud, windows-10.0.19045 ClientArchitecture: x86_64 OsArchitecture: x86_64)"
***.***.***.*** - myuser [16/Apr/2024:00:56:28 +0300] "PROPFIND /remote.php/dav/files/myuser/ HTTP/1.1" 207 1193 "-" "Mozilla/5.0 (Windows) mirall/3.12.3stable-Win64 (build 20240328) (Nextcloud, windows-10.0.19045 ClientArchitecture: x86_64 OsArchitecture: x86_64)"
127.0.0.1 - myuser [16/Apr/2024:00:56:35 +0300] "POST //ocs/v2.php/apps/notifications/api/v2/admin_notifications/myuser HTTP/1.1" 403 3946 "-" "Apprise"

NC 27.1.8

Several thoughts: short name of my domain, which is private, self-signed, and consists of 2 words; I use 2FA (the password is created for a specific device). I've tried to remove password, change it, however the error remains the same:

So, with the command

apprise -vvvvv -t "title" -b "body" nclouds://myuser:ABCD-EFG-HIJ-KLM@my.local/myuser

I am getting this trace error:

2024-04-16 01:10:47,100 - DEBUG - Loaded Nextcloud URL: nclouds://myuser:****@my.local/myuser?version=21&format=text&overflow=upstream&rto=4.0&cto=4.0&verify=yes
2024-04-16 01:10:47,100 - DEBUG - Nextcloud v21 POST URL: https://a3.local//ocs/v2.php/apps/notifications/api/v2/admin_notifications/myuser (cert_verify=True)
2024-04-16 01:10:47,100 - DEBUG - Nextcloud v21 Payload: {'shortMessage': 'title', 'longMessage': 'body'}
2024-04-16 01:10:47,359 - WARNING - Failed to send Nextcloud v21 notification:error=403.
2024-04-16 01:10:47,361 - DEBUG - Response Details:
b''
ostasevych commented 2 months ago

Sorry, I found the issue, the local IP address wasn't in the list of allowed to be logged in! Everything works from now.