0
我一直在使用服務帳戶運行幾周的Ruby腳本,但今天我得到一個「無效請求」,當我嘗試構建客戶端使用以下功能:谷歌API客戶端突然回來與「無效請求」
def build_client(user_email)
client = Google::APIClient.new
client.authorization = Signet::OAuth2::Client.new(
:token_credential_uri => 'https://accounts.google.com/o/oauth2/token',
:audience => 'https://accounts.google.com/o/oauth2/token',
:scope => 'https://www.googleapis.com/auth/calendar',
:issuer => SERVICE_ACCOUNT_EMAIL,
:signing_key => Google::APIClient::KeyUtils.load_from_pkcs12(SERVICE_ACCOUNT_PKCS12_FILE_PATH, "notasecret"),
:person => user_email
)
client.authorization.fetch_access_token!
return client
end
服務帳戶是否有使用壽命?我試圖創建另一個服務帳戶,並使用它,但我得到了相同的結果:
Authorization failed. Server message: (Signet::AuthorizationError)
{
"error" : "invalid_request"
}
難住!