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

21 lines
477 B
JavaScript
Raw Normal View History

2024-04-24 14:04:29 -05:00
const {
MatrixAuth,
} = require('matrix-bot-sdk');
2024-04-24 14:04:02 -05:00
require('dotenv').config();
2024-04-24 14:04:29 -05:00
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}"`);
2024-04-24 14:04:29 -05:00
};
login();