dgf-prototype/backend/scripts/matrix-login.js

21 lines
477 B
JavaScript

const {
MatrixAuth,
} = require('matrix-bot-sdk');
require('dotenv').config();
const {
MATRIX_HOMESERVER_URL,
MATRIX_USER,
MATRIX_PASSWORD,
} = process.env;
const login = async () => {
console.log(`MATRIX_HOMESERVER_URL="${MATRIX_HOMESERVER_URL}"`);
const auth = new MatrixAuth(MATRIX_HOMESERVER_URL);
const matrixClient = await auth.passwordLogin(MATRIX_USER, MATRIX_PASSWORD);
console.log(`MATRIX_ACCESS_TOKEN="${matrixClient.accessToken}"`);
};
login();