Php Google API Oauth1到Oauth2迁移:要么令牌无效,要么我们无法解码它
我编写了一个PHP脚本,使用Curl从oauth1迁移到oauth2,标题正确,表单数据也正确,但响应总是:Php Google API Oauth1到Oauth2迁移:要么令牌无效,要么我们无法解码它,php,curl,oauth,google-oauth,Php,Curl,Oauth,Google Oauth,我编写了一个PHP脚本,使用Curl从oauth1迁移到oauth2,标题正确,表单数据也正确,但响应总是: { ["error"]=> string(13) "invalid_token" ["error_description"]=> string(54) "Either the token is invalid or we could not decode it." } 下面是Curl的详细内容: POST/o/oauth2/token HTTP/1.1 主持
{
["error"]=>
string(13) "invalid_token"
["error_description"]=>
string(54) "Either the token is invalid or we could not decode it."
}
下面是Curl的详细内容:
POST/o/oauth2/token HTTP/1.1
主持人:accounts.google.com
接受:/
授权:OAuth OAuth_consumer_key=“mykey.com”,OAuth_nonce=“1416228848”,OAuth_signature_method=“HMAC-SHA1”,OAuth_token=“1%252FNZL27URrdQlwLe”,OAuth_timestamp=“1416228848”,OAuth_version=“1.0”,OAuth_signature=“qcX5MW%2BuxUYZ7J7X8”
内容长度:230
内容类型:application/x-www-form-urlencoded
我在多个令牌上尝试了它,它返回了相同的消息 嗨,你的问题解决了吗?我现在也在努力解决这个问题
* upload completely sent off: 230 out of 230 bytes
< HTTP/1.1 400 Bad Request
$params = [
"grant_type" => "urn:ietf:params:oauth:grant-type:migration:oauth1",
"client_id" => $oauth2_client_id,
"client_secret" => $oauth2_client_secret,
"scope" => "https://mail.google.com"
];
$postData=http_build_query($params, '', '&');