Opened 7 years ago
Closed 7 years ago
#2907 closed defect (bug) (fixed)
Tagregator: Instagram items not getting pulled
Reported by: |
|
Owned by: |
|
---|---|---|---|
Milestone: | Priority: | high | |
Component: | WordCamp Site & Plugins | Keywords: | has-patch dev-feedback has-screenshots needs-testing |
Cc: |
Description
It looks like the Instagram API may have changed (quite some time ago, actually) and the plugin is no longer able to authenticate and get data. This was reported for WCUS 2016 and also here.
Here's an example of the request URL being sent currently and a relevant part of the response:
URL:
https://api.instagram.com/v1/tags/wcus/media/recent?client_id=XXXXXXX
Response:
[body] => {"meta": {"code": 400, "error_type": "OAuthAccessTokenException", "error_message": "The access_token provided is invalid."}} [response] => Array ( [code] => 400 [message] => Bad Request )
The Instagram source class needs to be updated to comply with the changes to the API.
Attachments (4)
Change History (21)
#3
@
7 years ago
Updating, just wanted to inform you that I managed to make a seamless process through Tagregators Settings page to retrieve the access_token needed so I will have a patch uploaded really soon. I just need to run some extra tests.
Best regards,
Konstantinos
#4
@
7 years ago
- Keywords has-patch 2nd-opinion dev-feedback has-screenshots added; needs-patch removed
Okay so! After a lot of fiddling with instagrams new API I managed to make a really easy process on installing it's Access Token without having the user going back and forth on accepting urls etc.
As you will see in the Patch I have 2 different methods for getting the posts in tggr-source-instagram.php
.
One is for the /users/self API call that also works when Sandboxed.
One for /tags/$/ that works ONLY if there is public access enabled in instagram.
Before commiting the patch you will have to alter the code again to whatever is more useful depending on what you need for the WordCamps.
If the apps created for WordCamps don't have public access enabled and they are sandboxed the tags public call will not work. Only the 'self' that is currently in code now will.
Now part from that for a weird reason that I cannot find out I'm always getting an error from:
[22-Jul-2017 11:26:20 UTC] PHP Notice: Undefined index: consumer_key in tggr-source-twitter.php on line 152 [22-Jul-2017 11:26:21 UTC] PHP Notice: Undefined index: consumer_secret in tggr-source-twitter.php on line 152
This is probably a different problem from the twitter settings but it causes the options to reset. I was not able to fix it I'm just informing you of this as well.
Maybe I'll make a new ticket about it ?
I'm marking this as 'has-patch' as the instagram problem is fixed but it needs good testing as I'm not sure how everything else works in there _ hahah.
This is a working screenshot using the /self/ api as I'm sandboxed so it reads only my own posts.
Best regards,
Konstantinos
This ticket was mentioned in Slack in #meta by xkon. View the logs.
7 years ago
#6
@
7 years ago
2907.2.diff fixes all of Instagram API issues and adds 2 modes, Sandbox + Public.
The Settings page has been changed along with Instructions within to help the users.
Sandbox works with /self/ so it retrieves the photos of the account that is bound to the Client ( this does not work with #hashtags unfortunately ) and Non-Sandbox works with hashtags on all of Instagram as before.
Attention: Previous Patch to apply #2100 , Next patch to apply #3003 .
Best regards,
Konstantinos
#7
@
7 years ago
2907.3.diff Updates the code to use wp_remote_post ( instead of cURL in 2907.2.diff ) as suggested by @coreymckrill and @sergey on the last ticket scrub in #meta-wordcamp .
Thanks both of you guys for pointing the way, it is actually much easier getting it done like this.
Best regards,
Konstantinos
This ticket was mentioned in Slack in #meta-wordcamp by coreymckrill. View the logs.
7 years ago
This ticket was mentioned in Slack in #meta-wordcamp by iandunn. View the logs.
7 years ago
#12
@
7 years ago
- Owner changed from coreymckrill to xkon
- Status changed from accepted to assigned
2907.3.diff looks to be in very good shape.
A few minor changes were requested in the bug scrub today, and after that @sergeybiryukov is planning to do a security review.
This ticket was mentioned in Slack in #meta-wordcamp by coreymckrill. View the logs.
7 years ago
This ticket was mentioned in Slack in #meta-wordcamp by coreymckrill. View the logs.
7 years ago
#15
@
7 years ago
@xkon , can you explain why the sandbox mode is needed? Is that part of the oAuth flow or something? We should probably document that in the code, since it's not obvious.
#16
@
7 years ago
Hey @iandunn , sorry for the late reply.
Yes SandBox mode was added as Instagram denies 'public access' to the API if your application is still sandboxed and you can only retrieve your own accounts posts.
At least that's what was happening as my application is actually on SandBox.
Basically for testing purposes OR if somebody wanted to just list his own posts he could turn on SandBox mode and retrieve his own account posts only. Please mind that this cancels out the #hashtag search and retrieves everything under the account token given.
I will get back to it as soon as possible and re-check everything as I've read that the API might have changed again with Facebook and vice versa.
Need to test everything again I suppose and see if there are changes to be done.
Tell me if we want to keep the SandBox and rename it maybe to something more user-friendly or scrap it completely even :) .
I'd prefer to keep it since most new API applications will be marked as SandBox so the users can at least set up their API tokens correctly.
#17
@
7 years ago
- Resolution set to fixed
- Status changed from assigned to closed
@xkon I took your patch and made a few modifications before committing it to the Tagregator repo. You can see the changeset here:
https://plugins.trac.wordpress.org/changeset/1779646/
Note that this keeps the sandbox mode. We might need to eventually add clearer instructions on how to move it from sandbox to public, but it worked fine for WordCamp US.
Thanks again for your work on this!
Hello @coreymckrill ! If the current users are not sandboxed ( as most where when the new API came out ) and they have the
public scope
on Instagrams Api then you can use the same url but by exchanging the?client_id=XXXXXXX
with an?access_token=XXXXXX
. Of course we have to find a way to get that access token either with cURL ( that would require a ton of redirects ) or with a little 'bypass' and a copy paste.Unfortunately I don't have a public_scoped account to test this but I can create the whole process if you like so you can test it out with a normal account maybe?
In the case that the users are sandboxed we only get access to the users uploaded pics.
So I need some more info to try and get this done first :) .
Best regards,
Konstantinos