logOut Last updated: 09. Dec 2025

API only function

Logs current user out from docly session via API.

Parameters

This function takes no parameters

Returns

Log out result.

Example

Code example (#JS)

#JS is mixed HTML (or other text file) with inline JavaScript with # starting and ending each inline statement.
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Log out!</title>
</head>
<body style="font-size:2em; text-align:center; font-family: arial; margin-top:2em;">
    <div id="message">You are now logging out! ⏳</div>
    <a style="display:none" id="link1" href="/">Log in again</a>
    <script>
        // Fetch "API/LogOut" and then display "You are now logged out!"
        fetch('API/LogOut')
            .then(response => response.json())
            .then(data => {
                document.getElementById('message').innerText = 'Thank you, you are now logged out!';
                document.getElementById("link1").style.display = "";
            })
            .catch(error => {
                // Display error message in GUI
                document.getElementById('message').innerText = 'Error during logout: ' + error.message;
                console.error('Error:', error);
            });
    </script>
</body>
</html>

Code example (JS)

JS is normal JavaScript either running in the browser or on the Docly™ server.
// #/API/LogOut.js
() => {
    return docly.logOut();    
}