Instagram API changes?


#1

Anyone up on the status of plugins like https://github.com/artifex404/grav-plugin-instagram with the changes to the Instagram API?

Do they still work?


#2

Hard to say. Did you try asking the author?


#3

Instagram now requires you to have an access_token.

Login in to Instragram Developer page and create a new client. Fill in the info.

Use this OceanWP to obtain your access_token.

You can view their page on how to obtain an Instagram access token as well.


#4

Appreciate the reply. @duceduc. I have had a quick look through the documentation and created a test client. The URL provided by the instead API generates a feed, though the Grav test site (timeout?) generates the following error

Server Error
Sorry, something went terribly wrong!

0 - An exception has been thrown during the rendering of a template ("Error while trying to download (code: 400): https://api.instagram.com/v1/users/self/media/recent/?access_token=************&count=8 ").

For further details please review your logs/ folder, or enable displaying of errors in your system configuration.'

Appreciate any suggestions and I will try to dig deeper…

[I have removed the instagram access token and preached with ‘************’]


#5

Code: 4 may possible be “The access_token provided is invalid.”
With the url you provided, input your access token and access it via the browser. Do you still get an error?


#6

Appreciate the reply @duceduc. I can access the Instagram data directly via the URL generated (above with API key) — which has me a little stumped.

Only thing I can think of for now is that I am doing testing locally (using MAMP), and the domain for the API key is different (the site is not on a remote server/web accessible domain I registered to create the access token). I have not had a chance to test the site yet on a remote server…


#7

Have now tested on a web accessible domain (set the same as the ‘client’ website URL in the Instagram API settings).

Unfortunately still the same error

0 - An exception has been thrown during the rendering of a template ("Error while trying to download (code: 400)...

Access the URL via a browser window (with the access token) provides the necessary Instagram feed.

Being relatively new to Grav (and twig), I ant currently unable to ascertain the basis for the error.


#8

Not sure what is the cause. Syntax error in the twig file ?


#9

I have tried with a (modular) twig file based on a a skeleton, and one with all other content removed.

It appears the module might not work with the recent (December 2018) Instagram API changes…


#10

I am using the woo skeleton and the ceevee theme and it works for me. Both are modular as well.


#11

I’ll download and compare to see if I can identify the issue. Can you provide a link to your site so I can take a look? Thanks.


#12

Instagram plugin working for modular sites. Scroll 3/4 down.


#13

I have texted this with a clean installs of the boxify and woo skeletons. Same output (error).

I add

{{ instagram_feed() }}

For both, I added templates/modular/screenshots.html.twig

For those who may come here having issues, here is the output from the log file (access token/identifying data removed)

[2019-02-03 03:47:25] grav.CRITICAL: An exception has been thrown during the rendering of a template ("Error while trying to download (code: 400): https://api.instagram.com/v1/users/self/media/recent/?access_token= XXXXXX&count=7  "). - Trace: #0 /Applications/MAMP/htdocs/woo.grav/vendor/twig/twig/lib/Twig/Template.php(399): Twig_Template->displayWithErrorHandling(Array, Array) #1 /Applications/MAMP/htdocs/woo.grav/vendor/twig/twig/lib/Twig/Template.php(407): Twig_Template->display(Array) #2 /Applications/MAMP/htdocs/woo.grav/vendor/twig/twig/lib/Twig/Environment.php(363): Twig_Template->render(Array) #3 /Applications/MAMP/htdocs/woo.grav/system/src/Grav/Common/Twig/Twig.php(273): Twig_Environment->render('modular/screens...', Array) #4 /Applications/MAMP/htdocs/woo.grav/system/src/Grav/Common/Page/Page.php(789): Grav\Common\Twig\Twig->processPage(Object(Grav\Common\Page\Page), '<h1>Product Scr...') #5 /Applications/MAMP/htdocs/woo.grav/system/src/Grav/Common/Page/Page.php(672): Grav\Common\Page\Page->processTwig() #6 /Applications/MAMP/htdocs/woo.grav/vendor/twig/twig/lib/Twig/Template.php(673): Grav\Common\Page\Page->content() #7 /Applications/MAMP/htdocs/woo.grav/cache/twig/50/50209d0072fba1a5af74f1c33b0fbda9e39bd450869e806414c589020709cdde.php(45): Twig_Template->getAttribute(Object(Grav\Common\Page\Page), 'content', Array) #8 /Applications/MAMP/htdocs/woo.grav/vendor/twig/twig/lib/Twig/Template.php(215): __TwigTemplate_bcdfe9a8fb4a140e6ef895803bc790be7939c72fb66c22652433d58b5f92c87d->block_content(Array, Array) #9 /Applications/MAMP/htdocs/woo.grav/cache/twig/9a/9a295d6a7587170b6f491d7083dbe7956bbd9d6d231cba26b4c89cbe35cd0b76.php(161): Twig_Template->displayBlock('content', Array, Array) #10 /Applications/MAMP/htdocs/woo.grav/vendor/twig/twig/lib/Twig/Template.php(215): __TwigTemplate_010b5f2b9de7e7ed1a38be5af5a65aa6c9eb025801f2ff79a101cf9eead94915->block_body(Array, Array) #11 /Applications/MAMP/htdocs/woo.grav/cache/twig/9a/9a295d6a7587170b6f491d7083dbe7956bbd9d6d231cba26b4c89cbe35cd0b76.php(67): Twig_Template->displayBlock('body', Array, Array) #12 /Applications/MAMP/htdocs/woo.grav/vendor/twig/twig/lib/Twig/Template.php(428): __TwigTemplate_010b5f2b9de7e7ed1a38be5af5a65aa6c9eb025801f2ff79a101cf9eead94915->doDisplay(Array, Array) #13 /Applications/MAMP/htdocs/woo.grav/vendor/twig/twig/lib/Twig/Template.php(399): Twig_Template->displayWithErrorHandling(Array, Array) #14 /Applications/MAMP/htdocs/woo.grav/cache/twig/50/50209d0072fba1a5af74f1c33b0fbda9e39bd450869e806414c589020709cdde.php(27): Twig_Template->display(Array, Array) #15 /Applications/MAMP/htdocs/woo.grav/vendor/twig/twig/lib/Twig/Template.php(428): __TwigTemplate_bcdfe9a8fb4a140e6ef895803bc790be7939c72fb66c22652433d58b5f92c87d->doDisplay(Array, Array) #16 /Applications/MAMP/htdocs/woo.grav/vendor/twig/twig/lib/Twig/Template.php(399): Twig_Template->displayWithErrorHandling(Array, Array) #17 /Applications/MAMP/htdocs/woo.grav/vendor/twig/twig/lib/Twig/Template.php(407): Twig_Template->display(Array) #18 /Applications/MAMP/htdocs/woo.grav/vendor/twig/twig/lib/Twig/Environment.php(363): Twig_Template->render(Array) #19 /Applications/MAMP/htdocs/woo.grav/system/src/Grav/Common/Twig/Twig.php(380): Twig_Environment->render('modular.html.tw...', Array) #20 /Applications/MAMP/htdocs/woo.grav/system/src/Grav/Common/Service/OutputServiceProvider.php(27): Grav\Common\Twig\Twig->processSite('html') #21 /Applications/MAMP/htdocs/woo.grav/vendor/pimple/pimple/src/Pimple/Container.php(118): Grav\Common\Service\OutputServiceProvider->Grav\Common\Service\{closure}(Object(Grav\Common\Grav)) #22 /Applications/MAMP/htdocs/woo.grav/system/src/Grav/Common/Processors/RenderProcessor.php(19): Pimple\Container->offsetGet('output') #23 /Applications/MAMP/htdocs/woo.grav/system/src/Grav/Common/Grav.php(131): Grav\Common\Processors\RenderProcessor->process() #24 /Applications/MAMP/htdocs/woo.grav/system/src/Grav/Common/Grav.php(370): Grav\Common\Grav->Grav\Common\{closure}() #25 [internal function]: Grav\Common\Grav::Grav\Common\{closure}('render', 'Render', Object(Closure)) #26 /Applications/MAMP/htdocs/woo.grav/system/src/Grav/Common/Grav.php(346): call_user_func_array(Object(Closure), Array) #27 /Applications/MAMP/htdocs/woo.grav/system/src/Grav/Common/Grav.php(132): Grav\Common\Grav->__call('measureTime', Array) #28 /Applications/MAMP/htdocs/woo.grav/index.php(54): Grav\Common\Grav->process() #29 {main} [] []

It’s past my current knowledge to identity the issue.

I’ll look into the Social Feed plugin and see if that might do what I am seeking…


Edit. Similar error with the social feed plugin. I’ll try creating a new API client/access token


#14

For anyone who comes across this later, I had the same outcome with a clean install of Grav+admin 1.5.8.

Vanilla except for the instagram plugin