denyAccess Last updated: 01. May 2026

API only function

This function exits and returns a login required error.

See also: writeJwt deleteJwt logOut flagActivity getProfilePictureUrl Custom JWT login example

Parameters

This function takes no parameters

Returns

A login required error result with HTTP code 401.

Example

Code example (JS)

JS is normal JavaScript either running in the browser or on the Docly™ server.
// Block users who are not logged in
if (!request.Jwt) {
    return docly.denyAccess();
}

// Block users who don't have the required role
if (request.Jwt.access !== "admin") {
    return docly.denyAccess();
}

// Continue with the rest of the API logic...
// See writeJwt() for issuing a JWT and reading request.Jwt.