I get this error when I tried to use soap with the following piece of code.
Error
Uncaught SoapFault exception: [env:Sender] Consumer is not authorized to access %resources in ...
PHP
$wsdlUrl = 'http://local.magento.com/soap/default?wsdl&services=customerAccountManagementV1';
$opts = array('http' => array('header' => 'Authorization: Bearer n95e7at5r0wf6mj1xv6ynni62d4xbkfi'));
$context = stream_context_create($opts);
$soapClient = new SoapClient($wsdlUrl, ['version' => SOAP_1_2, 'context' => $context]);
$serviceArgs = array("customerId" => 1);
$soapResponse = $soapClient->customerAccountManagementV1IsReadonly($serviceArgs);
var_dump($soapResponse);
The token is correct and there is no problem when I test it using soapUI.
Can anyone help?