Using Symfony 2.0 and FOSOAuthServerBundle to implement an API Rest, I am having a little of trouble.
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).
These are the steps:
- Get the authorization code: everything goes fine and I get inserted the auth code in the database and returned by the engine. Perfect
-
Get the token: here is where the problem comes. When the code is generated (previous step), it is assigned an
expiresAtfield. And when I get to this pointpublic function hasExpired()
{
if ($this->expiresAt) {
return time() > $this->expiresAt;
}
}
it compares and returns true, i.e., the code is off (expired). 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). And it was because I was debugging it to see what was going on.
Sorry about that. I hope this helps anyone.