When using Laravels HTTP client with basic authentication to get a token, I keep getting a 401 - Unauthorized and I cant figure out why.
My code
$response = Http::withBasicAuth($username, $password)->post(
'https://api.sandbox.freeagent.com/v2/token_endpoint',
[
'grant_type' => 'authorization_code',
'code' => $code,
'redirect_uri' => urlencode($redirect_uri),
]
);
code
the response from Log in to your FreeAgent accountusername
is the value of OAuth identifier from the dashboardpassword
is the value of OAuth secrets from the dashboardredirect_uri
is my website
Any ideas?
Thanks in advance.