I don't know if it is a bug or a mistake into Cookbook (Step-By-Step Walkthrough), but when you call this one: curl -u testclient:testpass http://localhost/token.php -d 'grant_type=authorization_code&code=YOUR_CODE' It fails. I had to repeat the client_id and it worked.