Google Drive API消息“超出未经验证的使用的每日限额”。同时查看来自Saleforce的文件 [英] Google Drive API message "Daily Limit for Unauthenticated Use Exceeded." while viewing files from Saleforce

查看:416
本文介绍了Google Drive API消息“超出未经验证的使用的每日限额”。同时查看来自Saleforce的文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我创建了一个服务帐户,获得了json配置文件,并使用它请求访问令牌。回应是好的,我收到令牌。当我使用它上传文件时,一切正常,但是当我尝试查看文件夹中的文件时,它会返回错误消息

I created a service account, got json configuration file and I request an access token using it. The response is ok, I receive token. When I upload file using it everything is ok, but when I try to view files from a folder it returns error message


未经验证的每日限额使用超出。继续使用需要
注册。

Daily Limit for Unauthenticated Use Exceeded. Continued use requires signup.

我的服务帐户只需要访问自己的文件,它不会访问任何文件其他用户。
我的查看文件的代码(现在我尝试调试响应):

My service account only needs to access own files, it doesn't access files of any other users. My code for viewing files (right now I try to debug the response):

public List<String> getFilesList() {
    Http http = new Http();
    HttpRequest req = new HttpRequest();
    req.setMethod('GET');
    req.setEndpoint('https://www.googleapis.com/drive/v2/files?accessToken='+accessToken');
    HttpResponse resp = http.send(req);
    System.debug(resp);
    System.debug(resp.getBody());
    return null;
}


推荐答案

我发现什么是问题。我在URL地址而不是在标题中发送访问令牌。最终它是这样做的:

I found out what was the problem. I was sending access token in the url address instead of in the header. Eventually it I did it like this:

public List<String> getFilesList() {
 Http http = new Http();
 HttpRequest req = new HttpRequest();
 req.setMethod('GET');
 req.setEndpoint('https://www.googleapis.com/drive/v2/files);
 req.setHeader('Authorization', 'Bearer '+accessToken);
 HttpResponse resp = http.send(req);
 return null;
}

这篇关于Google Drive API消息“超出未经验证的使用的每日限额”。同时查看来自Saleforce的文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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