簡體   English   中英

Google Apps Provisioning API:HTTPBadRequest 400錯誤請求錯誤

[英]Google Apps Provisioning API: HTTPBadRequest 400 Bad Request error

我已經創建了一個Google Apps Marketplace應用,並且嘗試通過調用Google Apps Provisioning API來獲取Google Apps域中所有用戶的列表,但無法克服此錯誤:

#<Net::HTTPBadRequest 400 Bad Request readbody=true> 

這是我正在使用的代碼:

consumer = OAuth::Consumer.new(my_google.oauth_key,
                               my_google.oauth_secret,
                               :site => 'https://apps-apis.google.com/a/feeds/user/#readonly',
                               :http_method => :get)
access_token = OAuth::AccessToken.new consumer
result = access_token.get("https://apps-apis.google.com/a/feeds/my_domain.com/user/2.0?alt=json")

我的Google Apps清單文件中也有此文件:

<Scope id="scopeUsers">
  <Url>https://apps-apis.google.com/a/feeds/user/#readonly</Url>
  <Reason>Our App will be setup for your entire domain.</Reason>
</Scope>

我已經驗證了oauth_key和secret,並嘗試了許多其他可能性,但無法深入了解這一點。 我在這里想念什么嗎? 我可以嘗試其他選擇嗎?

HTTP響應還包括更具描述性的錯誤消息,解釋了您的請求為何無效的原因。 我不了解Ruby庫,但必須有一種訪問該字段的方法。 如果沒有,您還可以使用Wireshark或Fiddler之類的工具捕獲流量並檢查響應。

我發現了問題。 OAuth gem版本存在問題,我使用的是OAuth 0.4.6,需要使用OAuth 0.4.5與我使用的語法兼容。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM