From e5988f0db8805b71cf083bc569eeb1c0550a6bc6 Mon Sep 17 00:00:00 2001 From: datashaman Date: Mon, 25 Jan 2021 16:35:40 +0200 Subject: [PATCH] Fix token issue (#30) * Fix token issue, maybe * wip * wip --- src/ServiceBusChannel.php | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/ServiceBusChannel.php b/src/ServiceBusChannel.php index e838a52..7cd1310 100644 --- a/src/ServiceBusChannel.php +++ b/src/ServiceBusChannel.php @@ -158,11 +158,13 @@ function () { ] ); - switch ($response->getStatusCode()) { - case 200: - $json = json_decode((string) $response->getBody()); + $body = json_decode((string) $response->getBody(), true); + + $code = (int) Arr::get($body, 'code', $response->getStatusCode()); - return $json->token; + switch ($code) { + case 200: + return $body['token']; default: throw CouldNotSendNotification::loginFailed($response); }