summary refs log tree commit diff
path: root/synapse/api
diff options
context:
space:
mode:
authorMark Haines <mark.haines@matrix.org>2015-01-28 15:36:21 +0000
committerMark Haines <mark.haines@matrix.org>2015-01-28 15:43:41 +0000
commitc59bcabf0b5c0ab78c0f89da75b031993c4660d9 (patch)
tree5691f2b6cc16fb0435c78925004bc12392fa3a42 /synapse/api
parentMerge pull request #34 from matrix-org/remove_serialize_event_from_hs (diff)
downloadsynapse-c59bcabf0b5c0ab78c0f89da75b031993c4660d9.tar.xz
Return the device_id from get_auth_by_req
Diffstat (limited to '')
-rw-r--r--synapse/api/auth.py7
1 files changed, 5 insertions, 2 deletions
diff --git a/synapse/api/auth.py b/synapse/api/auth.py
index a342a0e0da..292e9e2a80 100644
--- a/synapse/api/auth.py
+++ b/synapse/api/auth.py
@@ -290,7 +290,9 @@ class Auth(object):
         Args:
             request - An HTTP request with an access_token query parameter.
         Returns:
-            UserID : User ID object of the user making the request
+            Tuple of UserID and device string:
+                User ID object of the user making the request
+                Device ID string of the device the user is using
         Raises:
             AuthError if no user by that token exists or the token is invalid.
         """
@@ -299,6 +301,7 @@ class Auth(object):
             access_token = request.args["access_token"][0]
             user_info = yield self.get_user_by_token(access_token)
             user = user_info["user"]
+            device_id = user_info["device_id"]
 
             ip_addr = self.hs.get_ip_from_request(request)
             user_agent = request.requestHeaders.getRawHeaders(
@@ -314,7 +317,7 @@ class Auth(object):
                     user_agent=user_agent
                 )
 
-            defer.returnValue(user)
+            defer.returnValue((user, device_id))
         except KeyError:
             raise AuthError(403, "Missing access token.")