Use accessToken instead of password

This commit is contained in:
Skylar Ittner 2023-09-05 22:08:00 -06:00
parent 5d3f6c226c
commit 3caf8a6502
2 changed files with 185 additions and 186 deletions

View File

@ -4,6 +4,7 @@
"matrixdomain": "matrix.org", "matrixdomain": "matrix.org",
"matrixuser": "smsbot", "matrixuser": "smsbot",
"matrixpass": "hunter2", "matrixpass": "hunter2",
"matrixaccesstoken": "",
"inviteusers": ["@annoyme:matrix.org"], "inviteusers": ["@annoyme:matrix.org"],
"smsapikey": "Voxtelesys SMS API key goes here", "smsapikey": "Voxtelesys SMS API key goes here",
"smsfrom": "Voxtelesys DID goes here", "smsfrom": "Voxtelesys DID goes here",

View File

@ -457,11 +457,10 @@ function handleHTTPRequest(req, res) {
} }
} }
const client = sdk.createClient({baseUrl: settings.homeserver}); const client = sdk.createClient({baseUrl: settings.homeserver, userId: settings.matrixuser, accessToken: settings.matrixaccesstoken});
var httpserver = express(); var httpserver = express();
var jsonParser = bodyParser.json(); var jsonParser = bodyParser.json();
client.login("m.login.password", {"user": settings.matrixuser, "password": settings.matrixpass}).then((response) => { client.startClient({initialSyncLimit: 10});
client.startClient();
logger.info("Plugged into the matrix."); logger.info("Plugged into the matrix.");
client.once('sync', function (state, prevState, res) { client.once('sync', function (state, prevState, res) {
logger.debug("Initial sync complete (" + state + ")"); logger.debug("Initial sync complete (" + state + ")");
@ -677,4 +676,3 @@ client.login("m.login.password", {"user": settings.matrixuser, "password": setti
logger.error("Error handling incoming event: " + ex); logger.error("Error handling incoming event: " + ex);
} }
}); });
});