Getting push messages without password

I'm writing an application interfacing OctoPrint, and I need to receive push messages. According to the protocol, the connection requires auth message to work, which means that the user has to enter its password. Is there any way to get push messages with only API key?


I think the REST API push updates is what you're looking for.

To get actual data via this channel, it is required to send an auth message with a username and a password. That's exactly the problem.

Then the only way I can think of is pulling the data on your own via other REST API calls.

Actually it is a username and a session key.

You can get both by POSTing to /api/login?passive=true with the API key header set. If the API key is valid, POSTing to /api/login?passive=true gets you a JSON document that contains both a user name associated with that API key and a session key. You can use these to set up the required auth for the push notification.

1 Like

fieldOfView, nice, thanks for that.

It seem to be working.However, the documentation says that passive login "retrieve information about the active user". What exactly does this mean? If no user has logged into OctoPrint, is passive login going to work?

‫בתאריך יום א׳, 24 במאי 2020 ב-16:28 מאת ‪william7Q via OctoPrint Community Forum‬‏ <‪‬‏>:‬

In this case the active user is the user associated with the provided API key.