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"
}
难住!