AuthSubSessionToken PHP 问题
如果我尝试从谷歌获取会话令牌,服务器不会响应。 我使用的代码是这样的:
$ch = curl_init("https://www.google.com/accounts/AuthSubSessionToken");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_FAILONERROR, true);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_HTTPHEADER, array(
'Authorization: AuthSub token="' . trim($token) . '"'
));
$result = curl_exec($ch);
curl_close($ch);
$splitStr = split("=", $result);
return trim($splitStr[1]);
但是服务器没有响应..没有错误代码..什么也没有..:( 我从 https://www.google.com/accounts/AuthSubRequest 获取的令牌是正确的因为我可以将它用作一次性令牌..
if I try to get a Session Token from google the server doesn't respond..
The code that I use is this:
$ch = curl_init("https://www.google.com/accounts/AuthSubSessionToken");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_FAILONERROR, true);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_HTTPHEADER, array(
'Authorization: AuthSub token="' . trim($token) . '"'
));
$result = curl_exec($ch);
curl_close($ch);
$splitStr = split("=", $result);
return trim($splitStr[1]);
but the server doesn't respond..No error code..nothing of nothing.. :(
The token that I take from https://www.google.com/accounts/AuthSubRequest is correct because I can use it as Single-use token..
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
只是为了检查 - 你检查过你的 apache 错误日志吗? Linux 上的 /var/log/httpd (或 apache2)?
确保完整的错误报告也已打开!将其放在页面顶部
编辑:
也尝试一下:
就在curl_close()之前
Just to check - have you checked your apache error logs? /var/log/httpd (or apache2) on linux?
Make sure full error reporting is on too! Drop this at the top of the page
EDIT:
Also try this:
just before curl_close()
不知道你是否明白了,问题是你应该使用 session=1 请求第一个令牌,如果你使用 session=0 请求将不起作用(我的失败并返回 403)
Dunno if you figured it out, the problem is that you should request the first token using session=1, if you use session=0 the request won't work (mine was failing with 403)