索引API 403权限被拒绝.无法验证网址所有权 [英] Indexing API 403 Permission denied. Failed to verify the URL ownership

查看:197
本文介绍了索引API 403权限被拒绝.无法验证网址所有权的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想从示例中执行代码:

I want to execute the code from the example:

    require_once 'google-api-php-client/vendor/autoload.php';

    $client = new Google_Client();

    // service_account_file.json is the private key that you created         for your service account.
    $client->setAuthConfig('service_account_file.json');
    $client->addScope('https://www.googleapis.com/auth/indexing');

    // Get a Guzzle HTTP Client
    $httpClient = $client->authorize();
    $endpoint =         'https://indexing.googleapis.com/v3/urlNotifications:publish';

    // Define contents here. The structure of the content is described in the next step.
    $content = "{
      \"url\": \"http://example.com/jobs/42\", //I used real url from my homepage
      \"type\": \"URL_UPDATED\"
    }";

    $response = $httpClient->post($endpoint, [ 'body' => $content ]);
    $status_code = $response->getStatusCode();

但作为响应,我收到一个错误:403权限被拒绝.无法验证URL所有权."

But in response, I get an error: 403 "Permission denied. Failed to verify the URL ownership.".

  1. 我创建了服务帐户,并在我的应用程序中读取了文件.
  2. 网站已验证. screeen1
  3. 对服务帐户的访问已完成. screeen2
  4. 我在搜索控制台和我的应用中使用了不带"www"和https的域.
  5. 已启用索引API,并发出了请求.
  1. I created service account and read the file in my application.
  2. Site verified. screeen1
  3. Access to service account is full. screeen2
  4. I used domain without "www" and https in search console and in my app.
  5. Indexing API enabled and requests come.

要获得访问权限,还需要做些什么并检查?

What else needs to be done and checked to gain access?

答案

完全访问权限!==所有者.我需要更好地阅读文档.

Full access !== Owner. I need to read the documentation better.

推荐答案

完全访问权限!==所有者.我需要更好地阅读文档.

Full access !== Owner. I need to read the documentation better.

这篇关于索引API 403权限被拒绝.无法验证网址所有权的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆