]> cat aescling's git repositories - mastodon.git/commitdiff
Allow access token in URI (#3208)
authorhappycoloredbanana <happycoloredbanana@users.noreply.github.com>
Sun, 21 May 2017 19:13:11 +0000 (22:13 +0300)
committerEugen Rochko <eugen@zeonfederated.com>
Sun, 21 May 2017 19:13:11 +0000 (21:13 +0200)
streaming/index.js

index b020d59fc4d8c5769bf9cac97d00c16b99ce8eaf..627b677a8ec1ae884a8fa80332525304ae814212 100644 (file)
@@ -199,8 +199,9 @@ if (cluster.isMaster) {
     }
 
     const authorization = req.get('Authorization');
+    const accessToken = req.query.access_token;
 
-    if (!authorization) {
+    if (!authorization && !accessToken) {
       const err = new Error('Missing access token');
       err.statusCode = 401;
 
@@ -208,7 +209,7 @@ if (cluster.isMaster) {
       return;
     }
 
-    const token = authorization.replace(/^Bearer /, '');
+    const token = authorization ? authorization.replace(/^Bearer /, '') : accessToken;
 
     accountFromToken(token, req, next);
   };