summary refs log tree commit diff
path: root/synapse/rest/client/v1/logout.py
diff options
context:
space:
mode:
authorMark Haines <mjark@negativecurvature.net>2016-09-09 17:09:27 +0100
committerGitHub <noreply@github.com>2016-09-09 17:09:27 +0100
commitdbff7e94362afdebaebe678215fba34589394fcf (patch)
treedb75c5d7a395a8b66bc6c1eca746f8bc4ab6cfd1 /synapse/rest/client/v1/logout.py
parentMerge pull request #1091 from matrix-org/paul/third-party-lookup (diff)
parentAdd helper function for getting access_tokens from requests (diff)
downloadsynapse-dbff7e94362afdebaebe678215fba34589394fcf.tar.xz
Merge pull request #1096 from matrix-org/markjh/get_access_token
Add helper function for getting access_tokens from requests
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, {}))