From ee1dc2bec44c7a9a459270070b8874352cb87b77 Mon Sep 17 00:00:00 2001 From: Nikos Filippakis Date: Mon, 6 Jul 2020 19:34:02 +0200 Subject: [PATCH] Add details about getting the access token and device ID to readme Signed-off-by: Nikos Filippakis --- README.md | 17 ++++++++++++++++- config.sample.yaml | 2 ++ 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 154e2ee..e3fc10f 100644 --- a/README.md +++ b/README.md @@ -26,13 +26,28 @@ go build github.com/matrix-org/go-neb BIND_ADDRESS=:4050 DATABASE_TYPE=sqlite3 DATABASE_URL=go-neb.db?_busy_timeout=5000 BASE_URL=http://localhost:4050 ./go-neb ``` -Get a Matrix user ID and access token and give it to Go-NEB: +Get a Matrix user ID and access token. You can do this, for example, with the following curl command by replacing the user ID, password and Synapse URL with your own. + +```bash +curl -X POST --header 'Content-Type: application/json' -d '{ + "identifier": { "type": "m.id.user", "user": "nebUsername" }, + "password": "nebPassword", + "type": "m.login.password" +}' 'http://localhost:8008/_matrix/client/r0/login' +``` + +This is preferable to, for example, logging in via Riot and copying the access token and device ID from there, as then Riot will have uploaded its own device keys which Go-NEB won't have access to causing it to be unable to create encryption sessions. + +The response of this command will be a JSON object with an access token and device ID. + +Then, give the values to Go-NEB: ```bash curl -X POST localhost:4050/admin/configureClient --data-binary '{ "UserID": "@goneb:localhost", "HomeserverURL": "http://localhost:8008", "AccessToken": "", + "DeviceID": "", "Sync": true, "AutoJoinRooms": true, "DisplayName": "My Bot" diff --git a/config.sample.yaml b/config.sample.yaml index 22d328f..00c10c2 100644 --- a/config.sample.yaml +++ b/config.sample.yaml @@ -21,6 +21,7 @@ clients: - UserID: "@goneb:localhost" AccessToken: "MDASDASJDIASDJASDAFGFRGER" + DeviceID: "DEVICE1" HomeserverURL: "http://localhost:8008" Sync: true AutoJoinRooms: true @@ -28,6 +29,7 @@ clients: - UserID: "@another_goneb:localhost" AccessToken: "MDASDASJDIASDJASDAFGFRGER" + DeviceID: "DEVICE2" HomeserverURL: "http://localhost:8008" Sync: false AutoJoinRooms: false