nbcommunication Posted March 15, 2021 Author Share Posted March 15, 2021 Hi @Tyssen, The message that the API is returning when I try to add my own account is "Error validating access token: Session has expired on Saturday, 24-Oct-20 00:35:05 PDT. The current time is Monday, 15-Mar-21 09:08:47 PDT". I tried regenerating the access token and got exactly the same message. This looks to me to be an issue on Facebook's end. I'll submit a bug report and see if they get back to me. Cheers, Chris Link to comment Share on other sites More sharing options...
nbcommunication Posted March 16, 2021 Author Share Posted March 16, 2021 Hi @Tyssen, I never got a bug report submitted yesterday (there's a lot of hoops to jump through). I've just been to check the process again and it has worked for me this time. Can you please try again? You may need to regenerate the access token from inside the Facebook developer admin, but worth trying the one you already have first. Cheers, Chris Link to comment Share on other sites More sharing options...
Tyssen Posted March 16, 2021 Share Posted March 16, 2021 @nbcommunication Yes, it's OK for me now. Another question though: you say that the module doesn't require OAuth for authentication but if I try and set up the module on my local version of the site, which isn't accessible outside my local network, I still get the same error. So at the moment, I only have an authorised account on the production version of the site (the same domain as I entered into the OAuth settings). How do I get my local version of the site authorised so I can work on template changes in my local environment? Link to comment Share on other sites More sharing options...
nbcommunication Posted March 16, 2021 Author Share Posted March 16, 2021 Hi @Tyssen, No idea why it says that in the README! It does use OAuth. Quick solution if you have access to phpMyAdmin, find the record in the instagram-basic-display-api table and copy it to your local copy. Cheers, Chris 1 Link to comment Share on other sites More sharing options...
Tyssen Posted March 16, 2021 Share Posted March 16, 2021 @nbcommunication Great thanks. I wasn't sure whether there was going to be something straightforward like that or not. ? Link to comment Share on other sites More sharing options...
cjx2240 Posted March 25, 2021 Share Posted March 25, 2021 Hi, first of all great module, very helpful. Found an odd issue with this, not sure if its just some issue with my own setup? I added a second user and used the wrong token (I had generated two for two different accounts and grabbed the wrong one) The new user doesn't appear in the list (though they're in the db table) I also couldn't remove the original user (though they disappeared from the db) It's using the value stored in the caches table but it restores itself even if I forcibly delete that cached row. Forcibly deleting the user row from the module table and then putting it back in right, fixed the user being fetched, although still shows the wrong one in the module settings. Link to comment Share on other sites More sharing options...
nbcommunication Posted March 26, 2021 Author Share Posted March 26, 2021 Hi @cjx2240, I've not come across this before. Hoping to have some time toward the end of next week, so will look at it then and see if I can replicate. Cheers, Chris Link to comment Share on other sites More sharing options...
nbcommunication Posted March 31, 2021 Author Share Posted March 31, 2021 Hi @cjx2240, I've tried to replicate this without success. I tried adding another account with a valid token from a different account, and I just got the 'User could not be added' response. Adding the second user with an incorrect token should not have resulted in a record being added to the database - I'm sure that this is what has caused the subsequent issues. It sounds like the original user details were partially overwritten with the new (incorrect) ones. No idea how this could've happened. Are there similarities in the usernames/ids? Are the two accounts linked in some way on the IG side? Cheers, Chris Link to comment Share on other sites More sharing options...
Stefanowitsch Posted August 28, 2021 Share Posted August 28, 2021 I just installed this module and am trying to authorize the user. Has anybody checked if the process of authorization which is described on the module page has changed? Basically I am stuck a the point where I need to generate a token and place it into the module settings. I have successfully generated a token, entered it but in the processwire logs I still get the message "username is not an authorized user.". Weird: After reloading the settings page in my facebook app the token which was just created seems to be gone. I found this instruction and the process of authorizing a user seems to be super complicated now: https://developers.facebook.com/docs/instagram-basic-display-api/getting-started Link to comment Share on other sites More sharing options...
nbcommunication Posted August 30, 2021 Author Share Posted August 30, 2021 Hi @Stefanowitsch, I've had a brief look over the docs you linked and I don't think anything else has changed. It is a fiddly process! I'll fire up my sandbox install and see if I can auth my own account when I get a chance, hopefully later today and let you know how I get on. In the meantime, might be worth uninstalling/reinstalling the module and trying again. Cheers, Chris Link to comment Share on other sites More sharing options...
nbcommunication Posted August 30, 2021 Author Share Posted August 30, 2021 Hi @Stefanowitsch, I've been able to set up my personal account on my sandbox PW install without any issues. I'd definitely recommend trying again, starting from scratch with the app setup if possible. Cheers, Chris Link to comment Share on other sites More sharing options...
Stefanowitsch Posted August 30, 2021 Share Posted August 30, 2021 Thanks for your reply! I was finally able to get it to work. In fact none of the cryptic steps mentioned here (https://developers.facebook.com/docs/instagram-basic-display-api/getting-started ) was necessary. I was in a rush and just copied this example code from the processwire module page to see what will render in the frontend. The problem was the line where a specific profile "username" was selected (as an example). I did not have an account like that in my module settings and that was the error. Link to comment Share on other sites More sharing options...
nbcommunication Posted August 31, 2021 Author Share Posted August 31, 2021 Hi @Stefanowitsch, Excellent, yes the module handles the URL callbacks. Glad you got it working and I hope you find the module useful. Cheers, Chris Link to comment Share on other sites More sharing options...
Stefanowitsch Posted August 31, 2021 Share Posted August 31, 2021 This module rocks! It comes just in time for a recent project I am working on. Is there a way to send you a kind of donation for your work? Link to comment Share on other sites More sharing options...
nbcommunication Posted August 31, 2021 Author Share Posted August 31, 2021 HI, Magic thanks - no donations, just delighted to get feedback! Cheers, Chris 1 Link to comment Share on other sites More sharing options...
Stefanowitsch Posted September 1, 2021 Share Posted September 1, 2021 I have a problem: I want to display the hashtags for each instagram post. This is no problem at all. But the encoding seems to be messed up. For example special characters like "ä ü ö ß" turn out as the notorious PHP <?> symbol. When displaying the caption instead (which contains the hashtags) all special characters are displayed correctly, though. Link to comment Share on other sites More sharing options...
nbcommunication Posted September 1, 2021 Author Share Posted September 1, 2021 Hi @Stefanowitsch, Are you getting the hashtags through the tags property (e.g. $instagram->getImages()->first->tags)? The caption is passed through $sanitizer->entities1($value, true), I suspect the tags will require the same treatment. This should be a straightforward fix, will try and replicate and fix this tomorrow. Cheers, Chris Link to comment Share on other sites More sharing options...
Stefanowitsch Posted September 2, 2021 Share Posted September 2, 2021 Yes, I am outputting the single tags like this: <? foreach($item->tags as $tag) { echo $tag . ' '; } ?> On Line 1048 of InstagramBasicDisplay.module I tried this, but the hashtag is then missing in the array: $tag = $this->wire('sanitizer')->entities1($tag, true); $item['tags'][] = strtolower($tag); Link to comment Share on other sites More sharing options...
nbcommunication Posted September 2, 2021 Author Share Posted September 2, 2021 Hi @Stefanowitsch, preg_match_all on line 1045 required a unicode flag. I've added that and released 1.4.3. That should hopefully be working for you now - please let me know if not! Cheers, Chris Link to comment Share on other sites More sharing options...
Stefanowitsch Posted September 2, 2021 Share Posted September 2, 2021 Thanks! I updated to Version 1.4.3 and checked the code line. Unfortunately the special characters still don't show up correctly ? I refreshed the PW module cache and the cache for the module itself but that did not help. That's not a big deal right now because the client I am working for wants the hash tags to be removed again (for layout reasons) but I think that might be a problem for other users at some point. Link to comment Share on other sites More sharing options...
nbcommunication Posted September 2, 2021 Author Share Posted September 2, 2021 Hi @Stefanowitsch, It is definitely working for me. It suggests that perhaps unicode support isn't available on your server? Could you supply an example caption that isn't working? I've been testing with a caption that uses the characters you mentioned but I'm maybe missing something. Cheers, Chris Link to comment Share on other sites More sharing options...
Stefanowitsch Posted September 3, 2021 Share Posted September 3, 2021 The content type of the response header says charset=utf-8 However here's the caption the tags are generated from. When printing this caption the special characters are all displayed correctly. •WERBUNG• Da strahlt nicht nur der #Pulli, sondern auch noch unsere liebe Aggi?? #Spaß auf der #Arbeit darf nicht fehlen, oder? #fashionstyle #redhead #redpullover #fun #wilster #wilstermarsch #blackweekend #prozenteaktion #Spaß becomes spa<?> Link to comment Share on other sites More sharing options...
nbcommunication Posted September 3, 2021 Author Share Posted September 3, 2021 Hi @Stefanowitsch, It is working for me with that example. Do you have access to any other server environments to test it out? I'm wondering if it may be related to this issue described here: https://stackoverflow.com/questions/7456939/what-is-the-preg-match-all-u-flag-dependent-on Cheers, Chris Link to comment Share on other sites More sharing options...
Stefanowitsch Posted September 5, 2021 Share Posted September 5, 2021 The problem with the special characters appears both on my local development environment (MAMP PRO) and on live site. I use the default PHP settings on both, nothing special. But this is no dealbreaker for me, I am not displaying any tags on the page. Link to comment Share on other sites More sharing options...
nbcommunication Posted September 7, 2021 Author Share Posted September 7, 2021 Hi @Stefanowitsch, Thanks. I'll leave the implementation as it is at the moment, if there are further reports of the issue I'll investigate further. Cheers, Chris 1 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