[英]How to develope a server application using Google Analytics API?
[英]Google for webmasters API: How to impersonate using server to server request?
我可以使用通過web 服務請求授予的訪問令牌訪問帶有谷歌 API 的網站列表,現在我想通過server to server request 進行訪問。
在授予服務器帳戶訪問列表的權限后,我無法使用以下范圍正確使用setAssertionCredentials
:
'https://www.googleapis.com/auth/webmasters'
情況1
模擬用戶帳戶時:
$cred->sub = 'user.account@gmail.com';
PHP 客戶端返回
'Error refreshing the OAuth2 token, message: '{ "error" : "unauthorized_client", "error_description" : "Unauthorized client or scope in request." }
案例二
在不模擬用戶帳戶的情況下,PHP 客戶端會得到一個空數組
題
如何模擬用戶使用服務器為網站管理員 API 請求服務 Google?
相關內容無答案
我會說通過服務器到服務器的請求來做到這一點會帶來一些麻煩。
由於您可以通過網絡服務請求獲取它,因此您可以向您的 php 函數發起一個外部觸發器,並將數據以 json 形式放在 Google Cloud Storage (GCS) 上作為 public ,這樣您就可以通過服務器到服務器請求訪問您需要的數據並在完成后立即刪除它。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.