From 020931dc98a4cace798a99d312b606b350b0ef9a Mon Sep 17 00:00:00 2001 From: Christian Weiske Date: Wed, 7 Sep 2016 22:50:08 +0200 Subject: [PATCH] check status code on access token fetch --- src/shpub/Command/Connect.php | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/shpub/Command/Connect.php b/src/shpub/Command/Connect.php index 68a4e18..02f60c7 100644 --- a/src/shpub/Command/Connect.php +++ b/src/shpub/Command/Connect.php @@ -98,6 +98,12 @@ class Command_Connect ) ); $res = $req->send(); + if (intval($res->getStatus() / 100) !== 2) { + Log::err('Failed to fetch access token'); + Log::err('Server responded with HTTP status code ' . $res->getStatus()); + Log::err($res->getBody()); + exit(2); + } if ($res->getHeader('content-type') != 'application/x-www-form-urlencoded') { Log::err('Wrong content type in auth verification response'); exit(2); -- 2.30.2