@walker Have you tried defining your header as key/value pair?
Http::withHeaders([
'Authorization' => 'Token *****',
])
Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.
Hi everyone, I'm trying to send a request to an external api to get data. The api is secured by OAuth 2.0. Via the postman, the results are returned to me correctly, but when I make a request with the application, I get a "message" => "Bad credentials" which is wrong?
The documentation provides such an example for an authorization sent in a header
curl -H 'Authorization: Token nbusr123' 'https://datahub.ekosystem.slovensko.digital/api/datahub/corporate_bodies/
$searchResults = Http::withHeaders([
'Authorization: Token *****',
])->get('https://datahub.ekosystem.slovensko.digital/api/datahub/corporate_bodies/search?q=cin:' . $this->search)->json();
@walker Have you tried defining your header as key/value pair?
Http::withHeaders([
'Authorization' => 'Token *****',
])
Please or to participate in this conversation.