after generating an new SHA key and generating the token Hash from the Firebase Cloud Messaging I’m getting an 400 Response with an “INVALID_DEVICE_KEY”:
Request:
{"format": "json", "pushTokenHash": "3669169ec4dcf07fa65e89e3b169c29cb143b3babc57bbaf7287d577abe250f80ab7ed3208de9b6fe5a41c3e2d38732f82d3639794a2cb83812c3efc989ca5b3", "devicePublicKey": "-----BEGIN RSA PUBLIC KEY-----\nMIIBCgKCAQEA5SwFt6lUDO1oxRUBE0MYkKnFfCfEv5wfxgblW50yCMcVoLk8gc+z\nUQTZjoKu9OWrk+X2uQkT1nEvOprJml4Hg6RtkNbC32W6xHJ6f7U9QkDq3BY9A7ii\n111GPw0zmcOzOsuiETqFx3qlRxOWnkBPfermx3Khhhk8BOmo1YrN8w37M+dCFk8z\nto5v3SEH5Hd0hw1LlOyMCe5AogvYrEnrTyecj2lgyiyj6mNwdR3ynS0bWDUnMYhG\njhqniaeI5B1xneThZC+JvwwwRnv41YO6kT0H7EcBQEkVoKWsj0ItSmqY5qXmJ2QT\nE+n2XVhz0Rlysho1EHH3WI43xIkS/dIqpQIDAQAB\n-----END RSA PUBLIC KEY-----\n", "proxyServer": "https://push-notifications.nextcloud.com/devices"}
The Documentation says to the message the following: “The device key does not match the one registered to the provided session token.”
Honestly I do not know what this means
Is the device Key the RSA “devicePublicKey” or something else? And why does it have to match something else?
What Session token?
I’ve tried Basic and Barer authentication, but I cannot register any device key beforehand while opaining the session token…
I do not have administrative access to the Nextcloud instance, but Push Notifications work with the official Nextcloud Talk app, so the Problem is definitely on my side.
Hello. I have not digged into all the details here. Before doing so, I wanted to als if I understood your question correctly or if my gut gives me a better impression.
what I get from the question
You want to create a new client for Android (or mobile to be more generic) to the Nextcloud talk app. You want to send notifications to the user to notify him about newly incoming messages.
What I guessed
You want to write a client for the talk app and want to receive messages by other users from the Nextcloud instance and send ones out during the normal chat operation.
I am asking as there are quite some unclear questions at the end and I would like to help if possible with the real problem.
yes, I built an App which utilizes the Nextcloud Talk API to display, and send messages, and that is working fine already.
What I want to archive are Push-Notifications. I want to get Notified even when my app is in Background or is closed. The Nextcloud Server provides a way to archive this via Google Firebase Cloud Messaging. I want to register a device from my app to the Nextcloud push service.
Recieving and sending messages is not an Problem, just the Notification which I want to display.
I reread the last answer and have to correct a bit.
The notification app is a way for other apps and the core to notify the user of events. These notifications will be shown in the web frontend and trigger also notifications by the Nextcloud native mobile app.
The registration with the server is intended to be done by the official app as far as I understand to deploy the messages to all Android devices with the app installed and the Nextcloud server registered. You would register with all notifications of the server not just you’re intended events of the talk. I am also unsure if talk will send events for all messages or only if you have no unread messages in the corresponding chat.
Yeah, I also utilize the webdav api from nextcloud, so getting all Notifications would be not an Problem, everything else I would filter out.
As already said, I’m trying to register a new device to the Nextcloud Server and after that to the Push-Proxy, so push notifications can be delivered.
From your screenshot the next paragraph contains information on the Push-Proxy. The Push Proxy is afaik built exactly for this purpose. I want to utilize the Push Proxy, but to register to the Push Proxy I need first to register on the Nextcloud server itself. And there lies my Problem.
Leaving aside the registration API for a second, to push to your application the push proxy need to be aware of multiple things (like push certificate, topic, etc.). This is not done via registration process, but on the proxy side. So this will not work „out of the box“ the way you might imagine.
So we created the push proxy push-notifications.nextcloud.com to protect our users and their data. We took some extra efforts and reduced the available information to a bare minimum for each of the sections.
You can register new devices to this push Proxy, which will proxy the notifications for you.
But before you can use the Push Proxy you’ll need to obtain data from the nextcloud server, and this is the point which is failing.