d'Hinnisdaël Posted October 18, 2018 Share Posted October 18, 2018 I kept running into the issue of self-invalidating access tokens and wanted the site's content editors to be able to handle the generation of new access tokens themselves. The module, however, limits those functions to superusers. Could you change the module to check for the module-admin permission? It's ProcessWire's internal permission to check who can edit module configurations. It's deactivated by default and has to be created and assigned manually, so there's no additional risk or security concern. On a standard PW installation, it still only applies to superusers. However, it gives people the possibility to allow editors to generate access tokens. So instead of if ($this->user->isSuperuser()) { $href = self::API_URL_AUTHORIZE . '?' . http_build_query($request); $link = "<a href='$href'>" . __('get Access Token') . "</a>"; } it's if ($this->user->isSuperuser() || $this->user->hasPermission('module-admin')) { $href = self::API_URL_AUTHORIZE . '?' . http_build_query($request); $link = "<a href='$href'>" . __('get Access Token') . "</a>"; } (There's a second check somewhere further down). Thanks for considering this. I forked the module for now, but would much rather like this to be incorporated into master. 2 Link to comment Share on other sites More sharing options...
BenSlayers Posted November 23, 2018 Share Posted November 23, 2018 On 6/14/2018 at 9:06 AM, MarcoPLY said: I still see this error in the log page every time some one visit the page: [InstagramFeed]: No user 'xxx' was found. 1 I have this same problem. Has anyone found a solution? 1 Link to comment Share on other sites More sharing options...
benbyf Posted December 7, 2018 Share Posted December 7, 2018 What is the recommedned way of getting another user's recently images? Am I right in saying in sandbox mode only the dev user can display their content, so it's needed to use the profile's account to setup the dev tokens etc, or is there a way of adding another username to the sandbox so I can query their images... Bit confusing sorry, but I can only display my own images currently, no matter what I add to the module options. Link to comment Share on other sites More sharing options...
d'Hinnisdaël Posted December 7, 2018 Share Posted December 7, 2018 @benbyf To save myself from the headaches, I only use scrapers anymore. No sandboxed accounts, no setup, no invalidated keys every two weeks. instagram-php-scraper has been working great so far. This is all there is to getting recent media of any user id or name: $userid = env('INSTAGRAM_USER_ID'); $instagram = new \InstagramScraper\Instagram(); $account = $instagram->getAccountById($userid); $username = $account->getUsername(); $latestMedia = $instagram->getMedias($username, 10); foreach ($latestMedia as $media) { if ($media->getType() === 'image') { [...] } } 2 Link to comment Share on other sites More sharing options...
benbyf Posted December 7, 2018 Share Posted December 7, 2018 @d'Hinnisdaël holy smokes, so shocking to me that their APi is so bad that we have to resort to this sort of thing ? Link to comment Share on other sites More sharing options...
d'Hinnisdaël Posted December 7, 2018 Share Posted December 7, 2018 Just now, benbyf said: @d'Hinnisdaël holy smokes, so shocking to me that their APi is so bad that we have to resort to this sort of thing ? True. Many of the recent API updates are about privacy, which is a good thing. But the rollout was more than ideal. And I'd love to go the official way and use their API. But I get emails from clients every other week, asking about invalidated API tokens after they log in from a hotel wifi. And setting up API tokens is quite the hassle. So yeah, it's scrapers for now… Link to comment Share on other sites More sharing options...
benbyf Posted December 10, 2018 Share Posted December 10, 2018 Quote To continuously improve Instagram users' privacy and security, we are accelerating the deprecation of Instagram API Platform, making the following changes effective immediately. We understand that this may affect your business or services, and we appreciate your support in keeping our platform secure. These capabilities will be disabled immediately (previously set for July 31, 2018 or December 11, 2018 deprecation). The following will be deprecated according to the timeline we shared previously: Public Content - all remaining capabilities to read public media on a user's behalf on December 11, 2018 Basic - to read a user’s own profile info and media in early 2020 For your reference, information on the new Instagram Graph API. https://www.dropbox.com/s/tl5zgx9h7iormf8/Screenshot 2018-12-10 13.53.46.png?dl=0 Just seen this on the instagram developer portal. I had a quick play with the facebook API explorer but couldn't get it to work as wanted (just display another user's profile image). Think we'll need to get going with this as instagram is stopping support for it's own API ? Link to comment Share on other sites More sharing options...
AndZyk Posted April 15, 2019 Share Posted April 15, 2019 If someone has issues with generating an access token, I now have learned that it is important to include a language with the request for the access token: https://www.instagram.com/oauth/authorize/?client_id=YOUR_CLIENT_ID&redirect_uri=http://page.dev/processwire/module/edit?name=InstagramFeed/&response_type=token&scope=public_content&hl=en Source: https://stackoverflow.com/questions/55449162/https-api-instagram-com-oauth-authorize-api-login-error So inside the "InstagramFeed.module", you should add 'hl' => 'en' in line 385: <?php $request = array( 'client_id' => $this->clientId, 'redirect_uri' => $redirect, 'response_type' => 'code', 'scope' => 'public_content', 'hl' => 'en' ); Regards, Andreas 1 Link to comment Share on other sites More sharing options...
iNoize Posted August 12, 2019 Share Posted August 12, 2019 hey together, for few days i have some trouble with this Module Quote {"error_type": "OAuthException", "code": 400, "error_message": "Invalid scope field(s): public_content"} I cant find the error. Also Updatet the language as @AndZyk told the post before. Anybody else the same problem ? Link to comment Share on other sites More sharing options...
iNoize Posted August 29, 2019 Share Posted August 29, 2019 Has nobody the same problem with this module? I think instagram changed the Api or something? Link to comment Share on other sites More sharing options...
dab Posted September 25, 2019 Share Posted September 25, 2019 I used this to get the access token: https://api.instagram.com/oauth/authorize/?client_id=CLIENT-ID&redirect_uri=https://www.yourdomainhere.co.uk/processwire/module/edit?name=InstagramFeed&response_type=code 1. Replace CLIENT-ID with your own CLIENT-ID code 2. I removed the trailing slash off suggested code on Processwire Module instructions http://page.dev/processwire/module/edit?name=InstagramFeed/ Works OK for me, but I am getting error code "[InstagramFeed]: No user" too, but otherwise feed working OK. Link to comment Share on other sites More sharing options...
iNoize Posted September 25, 2019 Share Posted September 25, 2019 10 minutes ago, dab said: I used this to get the access token: https://api.instagram.com/oauth/authorize/?client_id=CLIENT-ID&redirect_uri=https://www.yourdomainhere.co.uk/processwire/module/edit?name=InstagramFeed&response_type=code 1. Replace CLIENT-ID with your own CLIENT-ID code 2. I removed the trailing slash off suggested code on Processwire Module instructions http://page.dev/processwire/module/edit?name=InstagramFeed/ Works OK for me, but I am getting error code "[InstagramFeed]: No user" too, but otherwise feed working OK. Hmm Strange get still {"error_type": "OAuthException", "code": 400, "error_message": "Only response type \"code\" and \"token\" is allowed"} OKAY IT WORKS. There was a empty space on the end from URL Thanks a lot 1 Link to comment Share on other sites More sharing options...
diogo Posted October 1, 2019 Share Posted October 1, 2019 For some reason the instructions above were not working for me. After some googling I found this tool https://instagram.pixelunion.net/. f you're comfortable with trusting them, it works perfectly. Link to comment Share on other sites More sharing options...
James F Carr Posted October 2, 2019 Share Posted October 2, 2019 After a little tweaking, I was able to get the access token back from Instagram. Using the post by @AndZyk as a starting point, I removed the following line from the module code: 'scope' => 'public_content' Instagram returned the access token successfully. 1 Link to comment Share on other sites More sharing options...
nbcommunication Posted March 12, 2020 Share Posted March 12, 2020 Hello, With the API being deprecated at the end of this month, I've built a replacement module which uses the Instagram Basic Display API. Find out more here: Cheers, Chris 2 Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now