summary refs log tree commit diff
path: root/synapse/rest/client/v1/logout.py
diff options
context:
space:
mode:
authorErik Johnston <erik@matrix.org>2016-09-09 18:06:01 +0100
committerErik Johnston <erik@matrix.org>2016-09-09 18:06:01 +0100
commit3265def8c7b4a6e49bc9ee920aef45bb22beaf74 (patch)
tree0f069dbf73fc1abc5955922eb46b50598f5d9b6f /synapse/rest/client/v1/logout.py
parentFix incorrect attribute name (diff)
parentMerge pull request #1096 from matrix-org/markjh/get_access_token (diff)
downloadsynapse-3265def8c7b4a6e49bc9ee920aef45bb22beaf74.tar.xz
Merge branch 'develop' of github.com:matrix-org/synapse into erikj/batch_edus
Diffstat (limited to 'synapse/rest/client/v1/logout.py')
-rw-r--r--synapse/rest/client/v1/logout.py10
1 files changed, 2 insertions, 8 deletions
diff --git a/synapse/rest/client/v1/logout.py b/synapse/rest/client/v1/logout.py
index 9bff02ee4e..1358d0acab 100644
--- a/synapse/rest/client/v1/logout.py
+++ b/synapse/rest/client/v1/logout.py
@@ -15,7 +15,7 @@
 
 from twisted.internet import defer
 
-from synapse.api.errors import AuthError, Codes
+from synapse.api.auth import get_access_token_from_request
 
 from .base import ClientV1RestServlet, client_path_patterns
 
@@ -37,13 +37,7 @@ class LogoutRestServlet(ClientV1RestServlet):
 
     @defer.inlineCallbacks
     def on_POST(self, request):
-        try:
-            access_token = request.args["access_token"][0]
-        except KeyError:
-            raise AuthError(
-                self.TOKEN_NOT_FOUND_HTTP_STATUS, "Missing access token.",
-                errcode=Codes.MISSING_TOKEN
-            )
+        access_token = get_access_token_from_request(request)
         yield self.store.delete_access_token(access_token)
         defer.returnValue((200, {}))