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); }