OctoPrintClient.browser
¶
-
OctoPrintClient.browser.
login
(username, password, remember, opts)¶ Logs the browser into OctoPrint, using the provided
username
andpassword
as credentials. Ifremember
is set totrue
, the session will also persist across browser restarts.Example:
OctoPrint.browser.login("myusername", "mypassword", true) .done(function(response) { // do something with the response });
- Arguments
username (string) – Username to log in with
password (string) – Password to log in with
remember (bool) – “Remember me”
opts (object) – Additional request options
- Returns Promise
A jQuery Promise for the request’s response
-
OctoPrintClient.browser.
passiveLogin
(opts)¶ Tries to perform a passive login into OctoPrint, using existing session data stored in the browser’s cookies.
OctoPrint.browser.passiveLogin() .done(function(response) { // do something with the response })
var client = new OctoPrintClient({ baseurl: "https://example.com/", apikey: "..." }); client.browser.passiveLogin() .done(function(response) { // do something with the response, e.g. authenticate with the socket // via response.name and response.session })
- Arguments
opts (object) – Additional request options
- Returns Promise
A jQuery Promise for the request’s response
-
OctoPrintClient.browser.
logout
(opts)¶ Logs the browser out of OctoPrint.
- Arguments
opts (object) – Additional request options
- Returns Promise
A jQuery Promise for the request’s response