From ef00f3c8d5ef2dabf4f420a474816219eae12571 Mon Sep 17 00:00:00 2001 From: vulet Date: Sun, 17 Jan 2021 22:29:19 +0800 Subject: [PATCH] fix(auth): pass tokens on initial startup --- auth.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/auth.js b/auth.js index ddcd12f..054a21f 100644 --- a/auth.js +++ b/auth.js @@ -7,6 +7,8 @@ module.exports.getMatrixToken = async () => { matrixClient = sdk.createClient(registrar.config.matrix.domain); matrixClient.loginWithPassword(registrar.config.matrix.user, registrar.config.matrix.password) .then((response) => { + registrar.matrix_auth.access_token = response.access_token; + registrar.matrix_auth.user_id = response.user_id; fs.writeFileSync('matrix_auth.json', JSON.stringify(response, null, 2)); matrixClient.startClient(); }); @@ -41,6 +43,7 @@ module.exports.registerFediverseApp = async () => { redirect_uri: 'urn:ietf:wg:oauth:2.0:oob', }) .then((tokens) => { + registrar.fediverse_auth.access_token = tokens.data.access_token; fs.writeFileSync('fediverse_auth.json', JSON.stringify(tokens.data, null, 2)); }) .catch((e) => {