AuthSub目标路径前缀与提供的"next"不匹配.网址 [英] AuthSub target path prefix does not match the provided "next" URL
问题描述
我正在尝试在PHP中使用Gcal API.
I am trying to use the Gcal API in PHP.
我正在使用ZEND框架
I am using the ZEND framework
function getAuthSubUrl($company)
{
$next = "http://$company.mysite.com";
$scope = 'http://www.google.com/calendar/feeds/';
$secure = false;
$session = true;
return (Zend_Gdata_AuthSub::getAuthSubTokenUri($next, $scope, $secure, $session));
}
$authSubUrl = getAuthSubUrl();
echo "<a href=\"$authSubUrl\">login to your Google account"</a>
我不确定我在做什么错.我几乎完全按照Google的示例进行操作.
I am not sure what I am doing wrong here. I am following the google example almost exactly.
他们确实有$next = getCurrentUrl();
的示例,但是尝试时却出现未定义的错误.
They do have $next = getCurrentUrl();
in their expample but I am getting undefined errors when I try that.
推荐答案
我知道了,我使用的是一个子域,该子域正根据该子域转发到页面.我猜Google会尝试确保您的$ next页面是真实的,而我的页面只是转发的.一旦我将$ next设置为主域,它就可以正常工作.然后,我只是在URL中添加了一些GET变量,以将其转发回正确的位置.
I figured it out, I was using a subdomain that was forwarding to pages based on the subdomain. I guess Google tries to make sure that your $next page is real and mine were just forwards. Once I made $next the main domain it worked fine. I then just added some GET vars to the url to forward it back to the right place.
//$next = "http://$company.mysite.com";
$next = "http://mysite.com?company=$company";
这篇关于AuthSub目标路径前缀与提供的"next"不匹配.网址的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!