Upgrade twig to version 3 for php 8.1
[anoweco.git] / www / micropub.php
index 3cbfbe87da22524bbc093f7b18edc18386d7fc55..ab6af864ff1fef631fc45db57db5e130414c0133 100644 (file)
@@ -35,7 +35,8 @@ function validateToken($token)
         array(
             'http' => array(
                 'header' => array(
-                    'Authorization: Bearer ' . $token
+                    'Authorization: Bearer ' . $token,
+                    'Accept: application/json',
                 ),
                 'ignore_errors' => true,
             ),
@@ -52,10 +53,10 @@ function validateToken($token)
         );
     }
 
-    parse_str($res, $data);
+    $data = json_decode($res, true);
     //FIXME: they spit out non-micropub json error responess
-    verifyUrlParameter($data, 'me');
-    verifyUrlParameter($data, 'client_id');
+    verifyParameter($data, 'me');
+    verifyParameter($data, 'client_id');
     verifyParameter($data, 'scope');
 
     return [$data['me'], $data['client_id'], $data['scope']];