I need some to do integration with accounting software (Xero).
once an order is completed, it sends an API call to Xero to create an invoice in Xero. once Xero does a reconciliation that payment is received. it will be sending an API call to bagisto that payment is processed, and the order is good to ship.
Error: UnexpectedValueException
Invalid response received from Authorization Server. Expected JSON.
public function getAccessToken($grant, array $options = [])
{
$grant = $this->verifyGrant($grant);
$params = [
'client_id' => $this->clientId,
'client_secret' => $this->clientSecret,
'redirect_uri' => $this->redirectUri,
];
$params = $grant->prepareRequestParameters($params, $options);
$request = $this->getAccessTokenRequest($params);
$response = $this->getParsedResponse($request);
if (false === is_array($response)) {
throw new UnexpectedValueException(
'Invalid response received from Authorization Server. Expected JSON.'
);
}
$prepared = $this->prepareAccessTokenResponse($response);
$token = $this->createAccessToken($prepared, $grant);
return $token;
}
When I call the function the error occurred.
$response = $this->getParsedResponse($request);