This plugin integrates AdminJS with Matrix, enabling users to log in to the AdminJS panel using Matrix accounts through the MatrixAuthProvider. Users must have administrative privileges in Matrix to u
Ensure the Matrix user is already registered and has administrative privileges. This command should be executed directly on the Matrix server as it's a built-in Matrix-Synapse tool:
Note: The path to the homeserver.yaml file may vary depending on your Matrix installation. Common locations include:
/etc/matrix-synapse/homeserver.yaml /data/homeserver.yaml (if using Docker) Note: This method uses a single shared token for all AdminJS users, which remains valid indefinitely unless manually revoked.
Method 2: Matrix User Authentication
Using this authentication method, ensure that the user's account has administrative privileges in Matrix.
Method 3: Custom Authentication Provider
You can also create a custom provider and manually handle tokens. Here's an example implementation of a custom authentication provider based on email and password:
import { DefaultAuthProvider } from 'adminjs';
import componentLoader from './component-loader.js';
const provider = new DefaultAuthProvider({
componentLoader,
authenticate: async ({ email, password }) => {
// Example implementation - replace with your own authentication logic
const user = await db.users.findOne({ email });
if (user && await verifyPassword(user.password, password)) {
// Get or generate a Matrix token for this user
const matrixToken = await getMatrixTokenForUser(user);
return {
email: user.email,
_auth: {
matrixAccessToken: matrixToken
}
};
}
return null;
}
});
export default provider;
Contributing
Contributions to the @adminjs/matrix plugin are welcome. Please submit pull requests or open issues on GitHub for bug fixes, improvements, or new features.