[英]FOSOAuthServerBundle - The authorization code has expired
Using Symfony 2.0 and FOSOAuthServerBundle to implement an API Rest, I am having a little of trouble. 使用Symfony 2.0和FOSOAuthServerBundle来实现API Rest,我遇到了一些麻烦。
I have all configured. 我都配置好了。 I have a properly created client and I am trying to test the thing through a web browser (although the final thing will be to use the API form a iOS APP).
我有一个正确创建的客户端,我正在尝试通过网络浏览器进行测试(尽管最后的事情是使用来自iOS APP的API)。
These are the steps: 这些步骤是:
Get the token: here is where the problem comes. 获取令牌:问题出在这里。 When the code is generated (previous step), it is assigned an
expiresAt
field. 生成代码时(上一步),将为其分配一个
expiresAt
字段。 And when I get to this point 当我到达这一点
public function hasExpired() { if ($this->expiresAt) { return time() > $this->expiresAt; } }
it compares and returns true, ie, the code is off (expired). 它比较并返回true,即代码已关闭(过期)。 And, as such, I get the following in the browser:
而且,因此,我在浏览器中得到以下内容:
{"error":"invalid_grant","error_description":"The authorization code has expired"}
Any clue on this before I start to mess it all up? 在我开始弄乱之前,有任何线索吗?
Thank you. 谢谢。
Ok, forget it. 好,算了
The matter was just that It was taking more than 30 seconds between the generation of the authorization code (in step one) and the generation of the security token (second step). 关键在于,在生成授权码(在第一步中)和生成安全令牌(第二步)之间花了30秒钟以上。 And it was because I was debugging it to see what was going on.
那是因为我正在调试它以查看发生了什么。
Sorry about that. 对于那个很抱歉。 I hope this helps anyone.
我希望这对任何人都有帮助。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.