问题
我得到的最关注的错误是invalid_client
和invalid_grant
。我正在使用oauthplayground中的访问令牌。选择&在授权API范围时,我还填充了配置选项以使用我自己的客户端ID和密码,其必须是Web Application
类型,因为Installed/Native Application
和Service Account
会抛出{{ 1}}错误,您无法将重定向uris添加到控制台中的那些类型。
我喜欢其他许多其他类似问题的帖子,需要使用PHP客户端向CURL Google的API运行CRON作业。如果您可以在Web / LAMP环境中准确地解释如何为此目的使用已安装或服务帐户,我会全力以赴
EMPTY CURL DUMP:(从Google_CurlIO.php第110行转储)
mismatch_redirect_uri
PHP代码到OAUTH2&制作一份简单的报告
$opts = array();
$opts['headers'] = $requestHeaders;
$opts['data'] = $respData;
$opts['curl'] = curl_getinfo($ch);
$opts['curlversion'] = curl_version();
$opts['curlerror'] = curl_errno($ch);
$opts["params"] = $parsed;
echo(json_encode($opts));
curl_close($ch);
die(); // THIS DUMP RETURNS...
{
headers: {
content-type: "application/x-www-form-urlencoded",
content-length: 209
},
data: false,
curl: {
url: "https://accounts.google.com/o/oauth2/token",
content_type: null,
http_code: 0,
header_size: 0,
request_size: 0,
filetime: -1,
ssl_verify_result: 0,
redirect_count: 0,
total_time: 0.156,
namelookup_time: 0,
connect_time: 0.078,
pretransfer_time: 0,
size_upload: 0,
size_download: 0,
speed_download: 0,
speed_upload: 0,
download_content_length: -1,
upload_content_length: -1,
starttransfer_time: 0,
redirect_time: 0,
certinfo: [ ],
primary_ip: "74.125.21.84",
primary_port: 443,
local_ip: "192.168.0.108",
local_port: 64342,
redirect_url: ""
},
curlversion: {
version_number: 466432,
age: 3,
features: 3005,
ssl_version_number: 0,
version: "7.30.0",
host: "i386-pc-win32",
ssl_version: "OpenSSL/0.9.8y",
libz_version: "1.2.7",
protocols: [
"dict",
"file",
"ftp",
"ftps",
"gopher",
"http",
"https",
"imap",
"imaps",
"ldap",
"pop3",
"pop3s",
"rtsp",
"scp",
"sftp",
"smtp",
"smtps",
"telnet",
"tftp"
]
},
curlerror: 60,
params: [
"content-type: application/x-www-form-urlencoded",
"content-length: 209"
]
}
答案 0 :(得分:1)
我正在阅读你问题的第一部分。
刷新令牌不是一个访问令牌:它是用于获取访问令牌的令牌。
我假设您没有使用刷新令牌代替访问令牌。另请注意,刷新令牌不需要访问受保护资源:您需要一个访问令牌。