📝 Merge auth example with existing one

This commit is contained in:
Gina Häußge committed 2021-02-16 17:21:19 +01:00
1 parent 47eeb0eb00
commit 281c4b698c
3 files changed
+24 -15

No files matched your search

+2 -11
View File
@@ -68,17 +68,8 @@ OctoPrint's SockJS socket also accepts two commands from the client to the serve
"auth": "someuser:LGZ0trf8By"
}
Example for a auth roundtrip with only an API key, using the :ref:`JS Client Library <sec-jsclientlib-base>`:
.. sourcecode:: javascript
var client = new OctoPrintClient({baseurl: "http://example.com/octoprint1/", apikey: "apikey1"});
client.socket.connect();
client.browser.passiveLogin().done(function(response) {
client.socket.sendAuth(response.name, response.session).done(function() {
// the socket is now authenticated
})
})
An example for an auth roundtrip with only an API key using the :ref:`JS Client Library <sec-jsclientlib-base>`
can be found :ref:`here <sec-jsclient-socket-authsample>`.
.. mermaid::