From f953cc497cf7a4e06816b95ee23b3485db493436 Mon Sep 17 00:00:00 2001 From: Aaron Parecki Date: Wed, 23 Aug 2017 11:20:33 -0700 Subject: [PATCH] update indieauth client closes #18 --- composer.json | 2 +- composer.lock | 107 +++++++++++++++++++++---------------------- controllers/Auth.php | 4 +- 3 files changed, 56 insertions(+), 57 deletions(-) diff --git a/composer.json b/composer.json index 29e5a75..3cc6e34 100644 --- a/composer.json +++ b/composer.json @@ -4,7 +4,7 @@ "mf2/mf2": "~0.3", "indieweb/mention-client": "~1.1", "indieweb/representative-h-card": "0.1.*", - "indieauth/client": "0.1.*", + "indieauth/client": "0.2.*", "firebase/php-jwt": "~3.0", "league/route": "~1.2", "league/plates": "~3.1", diff --git a/composer.lock b/composer.lock index 31dee33..113d965 100644 --- a/composer.lock +++ b/composer.lock @@ -4,8 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file", "This file is @generated automatically" ], - "hash": "c1073e02a47a5b29ceff0e844c0d9ff7", - "content-hash": "ff7e305d795fe52c71dcc30cbacd9ad3", + "content-hash": "743002238143ee7368e8c5f8a6783cae", "packages": [ { "name": "barnabywalters/mf-cleaner", @@ -45,7 +44,7 @@ } ], "description": "Cleans up microformats2 array structures", - "time": "2014-10-06 23:11:15" + "time": "2014-10-06T23:11:15+00:00" }, { "name": "camspiers/json-pretty", @@ -81,7 +80,7 @@ } ], "description": "Provides support for json pretty printing", - "time": "2016-02-06 01:25:58" + "time": "2016-02-06T01:25:58+00:00" }, { "name": "emgiezet/errbit-php", @@ -147,7 +146,7 @@ "errbit php", "error tracking" ], - "time": "2015-11-04 14:49:04" + "time": "2015-11-04T14:49:04+00:00" }, { "name": "firebase/php-jwt", @@ -190,25 +189,25 @@ ], "description": "A simple library to encode and decode JSON Web Tokens (JWT) in PHP. Should conform to the current spec.", "homepage": "https://github.com/firebase/php-jwt", - "time": "2015-07-22 18:31:08" + "time": "2015-07-22T18:31:08+00:00" }, { "name": "indieauth/client", - "version": "0.1.14", + "version": "0.2.2", "source": { "type": "git", "url": "https://github.com/indieweb/indieauth-client-php.git", - "reference": "504ba095ee10ffaabc570682f3a93b462ba21c77" + "reference": "225ece31ddafaee3348eabdc915422c457498a84" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/indieweb/indieauth-client-php/zipball/504ba095ee10ffaabc570682f3a93b462ba21c77", - "reference": "504ba095ee10ffaabc570682f3a93b462ba21c77", + "url": "https://api.github.com/repos/indieweb/indieauth-client-php/zipball/225ece31ddafaee3348eabdc915422c457498a84", + "reference": "225ece31ddafaee3348eabdc915422c457498a84", "shasum": "" }, "require": { "barnabywalters/mf-cleaner": "0.*", - "indieweb/link-rel-parser": "0.1.1", + "indieweb/link-rel-parser": "0.1.*", "mf2/mf2": "~0.3", "php": ">5.3.0" }, @@ -229,7 +228,7 @@ } ], "description": "IndieAuth Client Library", - "time": "2016-04-04 14:57:04" + "time": "2017-07-01T15:43:45+00:00" }, { "name": "indieweb/link-rel-parser", @@ -275,7 +274,7 @@ "indieweb", "microformats2" ], - "time": "2013-12-23 00:14:58" + "time": "2013-12-23T00:14:58+00:00" }, { "name": "indieweb/mention-client", @@ -317,7 +316,7 @@ ], "description": "Client library for sending webmention and pingback notifications", "homepage": "https://github.com/indieweb/mention-client-php", - "time": "2016-04-15 08:11:41" + "time": "2016-04-15T08:11:41+00:00" }, { "name": "indieweb/representative-h-card", @@ -362,7 +361,7 @@ "mf2", "microformats" ], - "time": "2015-12-23 18:11:19" + "time": "2015-12-23T18:11:19+00:00" }, { "name": "ircmaxell/password-compat", @@ -404,7 +403,7 @@ "hashing", "password" ], - "time": "2014-11-20 16:49:30" + "time": "2014-11-20T16:49:30+00:00" }, { "name": "j4mie/idiorm", @@ -462,7 +461,7 @@ "orm", "query builder" ], - "time": "2014-06-23 13:08:57" + "time": "2014-06-23T13:08:57+00:00" }, { "name": "league/container", @@ -520,7 +519,7 @@ "injection", "league" ], - "time": "2015-04-05 17:14:48" + "time": "2015-04-05T17:14:48+00:00" }, { "name": "league/plates", @@ -572,7 +571,7 @@ "templating", "views" ], - "time": "2015-07-09 02:14:40" + "time": "2015-07-09T02:14:40+00:00" }, { "name": "league/route", @@ -630,7 +629,7 @@ "league", "route" ], - "time": "2015-09-11 07:40:31" + "time": "2015-09-11T07:40:31+00:00" }, { "name": "mf2/mf2", @@ -683,7 +682,7 @@ "parser", "semantic" ], - "time": "2016-03-14 12:13:34" + "time": "2016-03-14T12:13:34+00:00" }, { "name": "michelf/php-markdown", @@ -734,7 +733,7 @@ "keywords": [ "markdown" ], - "time": "2015-12-24 01:37:31" + "time": "2015-12-24T01:37:31+00:00" }, { "name": "monolog/monolog", @@ -812,7 +811,7 @@ "logging", "psr-3" ], - "time": "2016-04-12 18:29:35" + "time": "2016-04-12T18:29:35+00:00" }, { "name": "nikic/fast-route", @@ -855,7 +854,7 @@ "router", "routing" ], - "time": "2016-03-25 23:46:52" + "time": "2016-03-25T23:46:52+00:00" }, { "name": "p3k/caterpillar", @@ -892,7 +891,7 @@ } ], "description": "Caterpillar is a background queue manager", - "time": "2015-12-21 22:52:21" + "time": "2015-12-21T22:52:21+00:00" }, { "name": "pda/pheanstalk", @@ -942,7 +941,7 @@ "keywords": [ "beanstalkd" ], - "time": "2015-08-07 21:42:41" + "time": "2015-08-07T21:42:41+00:00" }, { "name": "predis/predis", @@ -992,7 +991,7 @@ "predis", "redis" ], - "time": "2015-07-30 18:34:15" + "time": "2015-07-30T18:34:15+00:00" }, { "name": "psr/log", @@ -1030,7 +1029,7 @@ "psr", "psr-3" ], - "time": "2012-12-21 11:40:51" + "time": "2012-12-21T11:40:51+00:00" }, { "name": "symfony/http-foundation", @@ -1085,7 +1084,7 @@ ], "description": "Symfony HttpFoundation Component", "homepage": "https://symfony.com", - "time": "2016-03-27 12:57:53" + "time": "2016-03-27T12:57:53+00:00" }, { "name": "symfony/polyfill-mbstring", @@ -1144,7 +1143,7 @@ "portable", "shim" ], - "time": "2016-01-20 09:13:37" + "time": "2016-01-20T09:13:37+00:00" }, { "name": "symfony/polyfill-php54", @@ -1202,7 +1201,7 @@ "portable", "shim" ], - "time": "2016-01-25 19:13:00" + "time": "2016-01-25T19:13:00+00:00" }, { "name": "symfony/polyfill-php55", @@ -1258,7 +1257,7 @@ "portable", "shim" ], - "time": "2016-01-20 09:13:37" + "time": "2016-01-20T09:13:37+00:00" } ], "packages-dev": [ @@ -1314,7 +1313,7 @@ "constructor", "instantiate" ], - "time": "2015-06-14 21:17:01" + "time": "2015-06-14T21:17:01+00:00" }, { "name": "myclabs/deep-copy", @@ -1356,7 +1355,7 @@ "object", "object graph" ], - "time": "2015-11-07 22:20:37" + "time": "2015-11-07T22:20:37+00:00" }, { "name": "phpdocumentor/reflection-docblock", @@ -1405,7 +1404,7 @@ "email": "mike.vanriel@naenius.com" } ], - "time": "2015-02-03 12:10:50" + "time": "2015-02-03T12:10:50+00:00" }, { "name": "phpspec/prophecy", @@ -1467,7 +1466,7 @@ "spy", "stub" ], - "time": "2016-02-15 07:46:21" + "time": "2016-02-15T07:46:21+00:00" }, { "name": "phpunit/php-code-coverage", @@ -1530,7 +1529,7 @@ "testing", "xunit" ], - "time": "2016-04-08 08:14:53" + "time": "2016-04-08T08:14:53+00:00" }, { "name": "phpunit/php-file-iterator", @@ -1577,7 +1576,7 @@ "filesystem", "iterator" ], - "time": "2015-06-21 13:08:43" + "time": "2015-06-21T13:08:43+00:00" }, { "name": "phpunit/php-text-template", @@ -1618,7 +1617,7 @@ "keywords": [ "template" ], - "time": "2015-06-21 13:50:34" + "time": "2015-06-21T13:50:34+00:00" }, { "name": "phpunit/php-timer", @@ -1659,7 +1658,7 @@ "keywords": [ "timer" ], - "time": "2015-06-21 08:01:12" + "time": "2015-06-21T08:01:12+00:00" }, { "name": "phpunit/php-token-stream", @@ -1708,7 +1707,7 @@ "keywords": [ "tokenizer" ], - "time": "2015-09-15 10:49:45" + "time": "2015-09-15T10:49:45+00:00" }, { "name": "phpunit/phpunit", @@ -1783,7 +1782,7 @@ "testing", "xunit" ], - "time": "2016-04-12 16:20:08" + "time": "2016-04-12T16:20:08+00:00" }, { "name": "phpunit/phpunit-mock-objects", @@ -1839,7 +1838,7 @@ "mock", "xunit" ], - "time": "2016-03-24 05:58:25" + "time": "2016-03-24T05:58:25+00:00" }, { "name": "sebastian/code-unit-reverse-lookup", @@ -1884,7 +1883,7 @@ ], "description": "Looks up which function or method a line of code belongs to", "homepage": "https://github.com/sebastianbergmann/code-unit-reverse-lookup/", - "time": "2016-02-13 06:45:14" + "time": "2016-02-13T06:45:14+00:00" }, { "name": "sebastian/comparator", @@ -1948,7 +1947,7 @@ "compare", "equality" ], - "time": "2015-07-26 15:48:44" + "time": "2015-07-26T15:48:44+00:00" }, { "name": "sebastian/diff", @@ -2000,7 +1999,7 @@ "keywords": [ "diff" ], - "time": "2015-12-08 07:14:41" + "time": "2015-12-08T07:14:41+00:00" }, { "name": "sebastian/environment", @@ -2050,7 +2049,7 @@ "environment", "hhvm" ], - "time": "2016-02-26 18:40:46" + "time": "2016-02-26T18:40:46+00:00" }, { "name": "sebastian/exporter", @@ -2116,7 +2115,7 @@ "export", "exporter" ], - "time": "2015-06-21 07:55:53" + "time": "2015-06-21T07:55:53+00:00" }, { "name": "sebastian/global-state", @@ -2167,7 +2166,7 @@ "keywords": [ "global state" ], - "time": "2015-10-12 03:26:01" + "time": "2015-10-12T03:26:01+00:00" }, { "name": "sebastian/object-enumerator", @@ -2213,7 +2212,7 @@ ], "description": "Traverses array structures and object graphs to enumerate all referenced objects", "homepage": "https://github.com/sebastianbergmann/object-enumerator/", - "time": "2016-01-28 13:25:10" + "time": "2016-01-28T13:25:10+00:00" }, { "name": "sebastian/recursion-context", @@ -2266,7 +2265,7 @@ ], "description": "Provides functionality to recursively process PHP variables", "homepage": "http://www.github.com/sebastianbergmann/recursion-context", - "time": "2015-11-11 19:50:13" + "time": "2015-11-11T19:50:13+00:00" }, { "name": "sebastian/resource-operations", @@ -2308,7 +2307,7 @@ ], "description": "Provides a list of PHP built-in functions that operate on resources", "homepage": "https://www.github.com/sebastianbergmann/resource-operations", - "time": "2015-07-28 20:34:47" + "time": "2015-07-28T20:34:47+00:00" }, { "name": "sebastian/version", @@ -2351,7 +2350,7 @@ ], "description": "Library that helps with managing the version number of Git-hosted PHP projects", "homepage": "https://github.com/sebastianbergmann/version", - "time": "2016-02-04 12:56:52" + "time": "2016-02-04T12:56:52+00:00" }, { "name": "symfony/yaml", @@ -2400,7 +2399,7 @@ ], "description": "Symfony Yaml Component", "homepage": "https://symfony.com", - "time": "2016-03-04 07:55:57" + "time": "2016-03-04T07:55:57+00:00" } ], "aliases": [], diff --git a/controllers/Auth.php b/controllers/Auth.php index 85ae019..2459e0f 100644 --- a/controllers/Auth.php +++ b/controllers/Auth.php @@ -106,14 +106,14 @@ class Auth { } // Verify the code with the auth server - $token = IndieAuth\Client::verifyIndieAuthCode($authorizationEndpoint, $request->get('code'), $state->me, self::_buildRedirectURI(), Config::$clientID, $request->get('state'), true); + $token = IndieAuth\Client::verifyIndieAuthCode($authorizationEndpoint, $request->get('code'), $state->me, self::_buildRedirectURI(), Config::$clientID, true); if(!array_key_exists('auth', $token) || !array_key_exists('me', $token['auth'])) { // The auth server didn't return a "me" URL $response->setContent(view('login', [ 'title' => 'Sign In to Telegraph', 'error' => 'Invalid Auth Server Response', - 'error_description' => 'The authorization server did not return a valid response:
'.htmlspecialchars(json_encode($token)).'
' + 'error_description' => 'The authorization server ('.$authorizationEndpoint.') did not return a valid response:
HTTP '.$token['response_code']."\n\n".htmlspecialchars($token['response']).'
' ])); return $response; }