Skip to main content

Basic authentication

The basic authentication is defined in RFC 7617 and transmits credentials as a username and password pair, encoded using Base64. The credentials are included in the Authorization header in the following format:

Authorization: Basic "username:password".toBase64Str()

Basic authentication transmits credentials as plaintext. It is strongly recommended to use HTTPS/TLS to protect sensitive or valuable information.

The main advantage of basic authentication is its simplicity, so it is suitable for testing, quick integrations, or internal applications. However, it is not recommended for production applications due to security limitations and the need to handle user credentials directly.

Authentication request examples

const axios = require("axios");

const username = "yourusername";
const password = "yourpassword";

const token = Buffer.from(`${username}:${password}`).toString("base64");
const headers = {
"Authorization": `Basic ${token}`
};

axios.get("https://yourportal.onlyoffice.com/api/2.0/people/@self", { headers })
.then(res => console.log(res.data))
.catch(err => console.error(err.response?.data || err.message));

Please note, that you have to enter your own portal address, username and password instead of yourportal.onlyoffice.com, yourusername and yourpassword respectively.