I'm trying to set things up on a test server at the moment and running into problems at this stage. This is my callback script after authorizing on XenForo. Code: $url = 'http://url.com/forum/api/index.php?oauth/token'; $vars = 'code=' . $authCode . '&client_id=' . $consKey . '&client_secret=' . $consSecret . '&redirect_url=' . $redirectURI . '&grant_type=authorization_code'; $ch = curl_init( $url ); curl_setopt( $ch, CURLOPT_POST, 1); curl_setopt( $ch, CURLOPT_POSTFIELDS, $vars); curl_setopt( $ch, CURLOPT_FOLLOWLOCATION, 1); curl_setopt( $ch, CURLOPT_HEADER, 0); curl_setopt( $ch, CURLOPT_RETURNTRANSFER, 1); $response = curl_exec( $ch ); print_r($response); The response I get is {"error":"invalid_client"} This is my first time really working with something like this, so all help is appreciated.
If you got "invalid_client", that means your client id/secret combination is not correct. Please double check it?
Oh my god, I feel so foolish, I had a typo. However, we're not out of the forest yet, now I'm getting 'invalid_request'
xfrocks @Warchamp7 That's some progress I think you have another typo: "redirect_url" should be "redirect_uri"
Warchamp7 @xfrocks Ahh, it seems it's one of those nights x.x Perhaps I should take a break for a bit More progress! I'm now getting {"error":"invalid_grant"}, where is the typo now ;_;
xfrocks @Warchamp7 You have reached this far so it's not a typo this time I think. There are 2 causes for this: You should make sure the $authCode is correct. You get it from a redirect after the authorization, right? The $redirectURI should match the one when you requested authorization. This is the common cause