public function oauth_token($client_id, $client_secret, $grant_type = 'client_credentials', $code = null, $audience = null, $scope = null)
{
$data = ['client_id' => $client_id, 'client_secret' => $client_secret, 'grant_type' => $grant_type];
if ($audience !== null) {
$data['audience'] = $audience;
}
if ($scope !== null) {
$data['scope'] = $scope;
}
if ($code !== null) {
$data['code'] = $code;
}
return $this->apiClient->post()->oauth()->token()->withHeader(new ContentType('application/json'))->withBody(json_encode($data))->call();
}