-
Notifications
You must be signed in to change notification settings - Fork 11
Error when posting to comments API #41
Comments
Perhaps it's a silly question, but are Signed Requests definitely enabled from the dashboard? |
Yes. I have both 'Disable implicit OAuth' and 'Enforce signed requests' checked on my dashboard. I'm currently able to delete comments, like and unlike posts without any issues. The only api endpoint that seems to not work is posting to comments. |
Ah okay, that's weird, I really haven't had time to investigate and I've got a lot on work-wise, I'll try and have a look soon |
I understand. Do you think you could point me in the right direction of where the root cause may be? I can try to take a look myself. |
Thanks so much, the classes I'd specifically check are One theory I just came up with is that possibly the signature generation requires hashing the request body in some way that I may have forgotten to do, so hopefully that might help. I'd like to think the codebase is somewhat coherent at a glance, so I hope you won't have too much trouble finding what's what 😄 |
Looks like you were right. The params sent to the generateSig function are missing the request params I'll give it a shot at fixing and let you know |
That would be lovely, if you could throw in a test case that would be supremely helpful as well 👍 |
Looked into it. Wasn't sure how to do it following exactly what you're doing. Would you create a interface for post params to pass into the All that needs to be done is pass the post parameters to the |
The POST parameters can be retrieved through |
Hmm. We need the parameters passed through to the function. There may be other things in the Request that we don't need. The getQueryParams in the UrlParserTrait will only get the access token. We would need to pass the parameters from the request call to the Client class $client->request('POST', "media/{$media_id}/comments, ['text' => $my_text]); The text needs to be added to the
in the generateSig() function in the SecureRequestMiddleware |
I haven't worked much with Middleware so am unsure of how to get the $options in a call such as
to reach the SecureRequestMiddleware generateSig() function. |
When posting to 'media/'.$post_id.'/comments' I get the following error:
I have attempted making the call using:
$instagram->secureRequests();
$instagram->comments()->create($post_id, $this->input->post('text'));
or
$instagram->secureRequests();
$function = 'POST';
$endpoint = 'media/'.$post_id.'/comments';
$params = ['form_params' => $params];
$instagram->request($function, $endpoint, $params);
All my GET requests are working fine. I also make a POST request to likes and that is working correctly.
The text was updated successfully, but these errors were encountered: