diff --git a/synapse/rest/client/capabilities.py b/synapse/rest/client/capabilities.py
index 3154b9f77e..002e8f3a4c 100644
--- a/synapse/rest/client/capabilities.py
+++ b/synapse/rest/client/capabilities.py
@@ -68,6 +68,9 @@ class CapabilitiesRestServlet(RestServlet):
"m.get_login_token": {
"enabled": self.config.auth.login_via_existing_enabled,
},
+ "org.matrix.msc3882.get_login_token": {
+ "enabled": self.config.auth.login_via_existing_enabled,
+ },
}
}
diff --git a/synapse/rest/client/login.py b/synapse/rest/client/login.py
index 7be327e26f..35f1899af2 100644
--- a/synapse/rest/client/login.py
+++ b/synapse/rest/client/login.py
@@ -174,6 +174,7 @@ class LoginRestServlet(RestServlet):
# If the login token flow is enabled advertise the get_login_token flag.
if self._get_login_token_enabled:
tokenTypeFlow["get_login_token"] = True
+ tokenTypeFlow["org.matrix.msc3882.get_login_token"] = True
flows.append(tokenTypeFlow)
flows.extend({"type": t} for t in self.auth_handler.get_supported_login_types())
diff --git a/tests/rest/client/test_capabilities.py b/tests/rest/client/test_capabilities.py
index cf23430f6a..77ab1a8b3d 100644
--- a/tests/rest/client/test_capabilities.py
+++ b/tests/rest/client/test_capabilities.py
@@ -200,6 +200,7 @@ class CapabilitiesTestCase(unittest.HomeserverTestCase):
self.assertEqual(channel.code, HTTPStatus.OK)
self.assertFalse(capabilities["m.get_login_token"]["enabled"])
+ self.assertFalse(capabilities["org.matrix.msc3882.get_login_token"]["enabled"])
@override_config({"login_via_existing_session": {"enabled": True}})
def test_get_get_token_login_fields_when_enabled(self) -> None:
@@ -214,3 +215,4 @@ class CapabilitiesTestCase(unittest.HomeserverTestCase):
self.assertEqual(channel.code, HTTPStatus.OK)
self.assertTrue(capabilities["m.get_login_token"]["enabled"])
+ self.assertTrue(capabilities["org.matrix.msc3882.get_login_token"]["enabled"])
diff --git a/tests/rest/client/test_login.py b/tests/rest/client/test_login.py
index 768d7ad4c2..f1ee67c00e 100644
--- a/tests/rest/client/test_login.py
+++ b/tests/rest/client/test_login.py
@@ -527,7 +527,11 @@ class LoginRestServletTestCase(unittest.HomeserverTestCase):
self.assertCountEqual(
channel.json_body["flows"],
[
- {"type": "m.login.token", "get_login_token": True},
+ {
+ "type": "m.login.token",
+ "get_login_token": True,
+ "org.matrix.msc3882.get_login_token": True,
+ },
{"type": "m.login.password"},
{"type": "m.login.application_service"},
],
diff --git a/tests/rest/client/test_login_token_request.py b/tests/rest/client/test_login_token_request.py
index ff83e88e3e..aaf8faafea 100644
--- a/tests/rest/client/test_login_token_request.py
+++ b/tests/rest/client/test_login_token_request.py
@@ -15,7 +15,7 @@
from twisted.test.proto_helpers import MemoryReactor
from synapse.rest import admin
-from synapse.rest.client import login, login_token_request, versions
+from synapse.rest.client import capabilities, login, login_token_request, versions
from synapse.server import HomeServer
from synapse.util import Clock
@@ -31,6 +31,7 @@ class LoginTokenRequestServletTestCase(unittest.HomeserverTestCase):
admin.register_servlets,
login_token_request.register_servlets,
versions.register_servlets, # TODO: remove once unstable revision 0 support is removed
+ capabilities.register_servlets, # TODO: remove once unstable revision 1 support is removed
]
def make_homeserver(self, reactor: MemoryReactor, clock: Clock) -> HomeServer:
@@ -179,18 +180,21 @@ class LoginTokenRequestServletTestCase(unittest.HomeserverTestCase):
def test_unstable_revision1_support(self) -> None:
# TODO: remove when unstable MSC3882 is no longer needed
+ self.register_user(self.user, self.password)
+ token = self.login(self.user, self.password)
+
# check feature is advertised in versions response:
channel = self.make_request(
- "GET", "/_matrix/client/versions", {}, access_token=None
+ "GET", "/_matrix/client/v3/capabilities", {}, access_token=token
)
self.assertEqual(channel.code, 200)
self.assertEqual(
- channel.json_body["unstable_features"]["org.matrix.msc3882"], True
+ channel.json_body["capabilities"]["org.matrix.msc3882.get_login_token"][
+ "enabled"
+ ],
+ True,
)
- self.register_user(self.user, self.password)
- token = self.login(self.user, self.password)
-
# check feature is available via the r1 unstable endpoint and returns an expires_in_ms value in milliseconds
channel = self.make_request(
"POST",
|