Jump to content

InstagramBasicDisplayApi


nbcommunication

Recommended Posts

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

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

@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

  • 2 weeks later...

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

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

  • 4 months later...

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

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

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

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

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

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

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

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

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

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

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...