本文介绍了Godaddy API授权错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试根据他们在此处提供的API为GoDaddy开发客户端应用程序. https://developer.godaddy.com 我有一个简单示例的问题,我正在尝试使用下一个PHP代码来检查域是否可用:

I am trying to develop client application for GoDaddy based on their API that they provide here https://developer.godaddy.comAnd I have a problem with simple example, I am trying to use the next PHP code to check if domain available:

use GuzzleHttp\Client;
try {
    $client = new Client([
        'base_uri' => 'https://api.godaddy.com',
    ]);

    $responce = $client->get(
        '/v1/domains/available?domain=example.guru',
        [
            'headers' => [
                'Authorization' => "sso-key $myKey:$mySecret",
                'X-Shopper-Id' => "$myID",
                'Accept' => 'application/json',
            ]
        ]
    );
    echo $responce->getBody();
} catch (Exception $e) {
    echo $e->getMessage();
}

并且总是出现错误:客户端错误:401".我在使用cURL库时遇到同样的问题.我没有找到任何在线支持.我需要帮助,有人可以解释我应该如何通过他们的api服务进行授权吗?也许我需要发送其他任何HTTP标头或其他参数?

And all the time I get error: "Client error: 401". Same problem I have with using cURL library. I didn't find any online support.I need help with it, can someone explain how I should authorize at their api service? Maybe I need to send any other http headers or additional params?

推荐答案

您用于生产的密钥和机密吗?当我完成此过程时,默认情况下会创建一个TEST密钥/秘密,我认为该密钥应与 https://api.ote-godaddy.com

Are the key and secret you're using for production? When I go through the process, by default it creates a TEST key/secret, which I think are meant to go against https://api.ote-godaddy.com

如果您使用的是生产密钥,请尝试通过以下命令执行手动Curl请求:像这样:

If you are using production keys, try doing a manual Curl request from the command like; something like:

curl -H 'Authorization: sso-key {KEY}:{SECRET}' -H 'Content-Type: application/json' https://api.godaddy.com/v1/domains/available?domain=example.guru'

让我们知道它是如何工作的!

Let us know how it works out!

这篇关于Godaddy API授权错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-02 01:03