Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

screwtape_mk's avatar

Guzzle 401 Authentication error for godaddy API

Hey Guys

im new to Guzzle and godaddy API. goDaddy has a test environment in which to test your API calls. I have successfully made a domain purchase in the test enivornment. When i now do this on Guzzle i get an Auth error 401.

My Controller:

$headers = ['Authorization' => 'sso-key $api_key:$api_secret'];

$client = new \GuzzleHttp\Client();


            
$response = $client->post($url, [
                    'headers' => $headers,
                     'form_params' => $bodyContent
                  ]);

$data=json_decode((string)$response->getBody());
dd($data);

Route:


Route::get('/domainpurchase',[
'uses'=>'GoDaddyController@PurchaseDomain',
]);

I have not shown the $bodyContent variable but its a Multidimentional array and it passes successfully on the posted on the goDaddy environment

The goDaddy API can be found here:https://developer.godaddy.com/doc/endpoint/domains#/v1/purchase

0 likes
1 reply

Please or to participate in this conversation.