From a469d1705975d39d3cd48bdfa130f882034c797f Mon Sep 17 00:00:00 2001 From: Brian Date: Sat, 16 Sep 2023 10:02:29 -0400 Subject: [PATCH 1/4] Update README.md Add curl command to get bearer token without a client. --- docs/usage/administration/admin_api/README.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/docs/usage/administration/admin_api/README.md b/docs/usage/administration/admin_api/README.md index 7c85bf751b04..871bf8bcd9f8 100644 --- a/docs/usage/administration/admin_api/README.md +++ b/docs/usage/administration/admin_api/README.md @@ -18,6 +18,12 @@ already on your `$PATH` depending on how Synapse was installed. Finding your user's `access_token` is client-dependent, but will usually be shown in the client's settings. +To get an access token from curl, make a request to `_matrix/client/r0/login` with `type`, `user`, and `password` included in the data field. + +```sh +curl -XPOST -d '{"type":"m.login.password", "user":"", "password":""}' "http://127.0.0.1:8008/_matrix/client/r0/login" +``` + ## Making an Admin API request For security reasons, we [recommend](../../../reverse_proxy.md#synapse-administration-endpoints) that the Admin API (`/_synapse/admin/...`) should be hidden from public view using a From 6085445533ea13fa13c72ce7fda14f58dd1f42df Mon Sep 17 00:00:00 2001 From: Brian Hudson Date: Sat, 16 Sep 2023 10:12:08 -0400 Subject: [PATCH 2/4] adding verbosity and fixing formatting --- docs/usage/administration/admin_api/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/usage/administration/admin_api/README.md b/docs/usage/administration/admin_api/README.md index 871bf8bcd9f8..f2e28e35efe6 100644 --- a/docs/usage/administration/admin_api/README.md +++ b/docs/usage/administration/admin_api/README.md @@ -18,7 +18,7 @@ already on your `$PATH` depending on how Synapse was installed. Finding your user's `access_token` is client-dependent, but will usually be shown in the client's settings. -To get an access token from curl, make a request to `_matrix/client/r0/login` with `type`, `user`, and `password` included in the data field. +To get an access token from cURL without a client, make a request to `_matrix/client/r0/login` with `type` set to `m.login.password`, `user`, and `password` set to their respective admin account values included in the data field: ```sh curl -XPOST -d '{"type":"m.login.password", "user":"", "password":""}' "http://127.0.0.1:8008/_matrix/client/r0/login" From 30e791f26ee056cdee7c515cc179077864528286 Mon Sep 17 00:00:00 2001 From: Brian Hudson Date: Sun, 17 Sep 2023 06:25:38 -0400 Subject: [PATCH 3/4] Adding changelog.d document. --- changelog.d/16330.doc | 1 + 1 file changed, 1 insertion(+) create mode 100644 changelog.d/16330.doc diff --git a/changelog.d/16330.doc b/changelog.d/16330.doc new file mode 100644 index 000000000000..96088fe0d0c0 --- /dev/null +++ b/changelog.d/16330.doc @@ -0,0 +1 @@ +Adding directions to the Admin section on getting a bearer token for an admin user with cURL. \ No newline at end of file From e54d06dc148f25fc6f93619e256f29b7bd8b6f53 Mon Sep 17 00:00:00 2001 From: Brian Hudson Date: Sun, 17 Sep 2023 06:37:40 -0400 Subject: [PATCH 4/4] Updating file name. --- changelog.d/16334.doc | 1 + 1 file changed, 1 insertion(+) create mode 100644 changelog.d/16334.doc diff --git a/changelog.d/16334.doc b/changelog.d/16334.doc new file mode 100644 index 000000000000..96088fe0d0c0 --- /dev/null +++ b/changelog.d/16334.doc @@ -0,0 +1 @@ +Adding directions to the Admin section on getting a bearer token for an admin user with cURL. \ No newline at end of file