potomak / jquery-instagram

Instagram jQuery plugin
http://potomak.github.io/jquery-instagram/
MIT License
554 stars 143 forks source link

Can you help me get your code to work again? #60

Closed antonygravett closed 8 years ago

antonygravett commented 8 years ago

I am having trouble understanding how to adapt your code to the new instagram requirement for an access token.

I have logged into my client’s account and created a client ID. I don’t know what to do next, in order to get the required access token. Instagram says in the docs* to "Direct the user to our authorization url” but does not provide the URL! Can you help with this?

Thanks in advance for any help you can provide. I am not an experienced developer but have some javascript and jquery experience. The three pages that use your code are:

http://corduroyshop.com//instagram-feeds/instagram-left.html http://corduroyshop.com//instagram-feeds/instagram-middle.html http://corduroyshop.com//instagram-feeds/instagram-right.html

Thanks again.

Antony Gravett

antonygravett commented 8 years ago

This appears to describe what I need, as I am only displaying the most recent three pictures for three hashtags:

Content Display for Personal Website. If you are a developer and you want to showcase Instagram content on a website, then you do not need to submit your app for review. By using a client in sandbox mode, you will still be able to access the last 20 media of any sandbox user that grants you permission

( Bottom of the page here: https://www.instagram.com/developer/sandbox/ )

antonygravett commented 8 years ago

I now have a clientID and token but I don’t understand how to format your code to include the token. Right now, I have this code:

$(document).ready(function() { var clientId = 'baee48560b984845974f6b85a07bf7d9'; $('.instagram.tag').on('didLoadInstagram', didLoadInstagram); $('.instagram.tag').instagram({ hash: '2016corduroyshopproduct', count: 3, clientId: clientId });

Where do I declare the token? I changed it to this, but Im only getting a blank:

$(document).ready(function() { var clientId = 'fa87515d29d348d3a897efd26a3cb93f'; var tokenId = '2324152311.fa87515.8adf2a0fc98d4093958453c1f9a816af'; $('.instagram.tag').on('didLoadInstagram', didLoadInstagram); $('.instagram.tag').instagram({ hash: '2016corduroyshopproduct', count: 3, clientId: clientId, tokenId: tokenId });

potomak commented 8 years ago

@antonygravett try to assign your token to the accessToken option instead of tokenId.

Example:

$('.instagram.tag').instagram({
  hash: '2016corduroyshopproduct',
  count: 3,
  clientId: clientId,
  accessToken: tokenId
}); 
antonygravett commented 8 years ago

Thanks so much, @potomak, for jumping in and advising. Sorry to be such a lost soul!

I think now that I may have my “knickers in a twist” because I obtained the access token for a different javascript framework (spectragram). I am now not sure how I get the correct token for your framework, which I would prefer to stay with, if possible.

To get the previous token, I logged into my client’s instagram account (thecorduroyshop) and registered a new client:

screenshot

I then used the following code to get the token:

https://api.instagram.com/oauth/authorize/?client_id=fa87515d29d348d3a897efd26a3cb93f&redirect_uri=http://corduroyshop.com&response_type=token

Can this same token be used for your instagram codebase? I am not getting it to work ... here is my latest attempt, with the accessToken variable used, as you suggested:

http://corduroyshop.com/instagram-feeds/160615-instagram-left-1.html

Apologies for the long post, but I’m stumped and could use your help!

antonygravett commented 8 years ago

I forgot to mention that I also set myself up as a Sandbox user, and logged in with my own IG account to accept that invite, and also obtained the token (using the above code) while logged-in.

I have also tried obtaining another token while logged-in as thecorduroyshop (admin), but that doesn’t work either:

http://corduroyshop.com/instagram-feeds/160615-instagram-left-2.html

potomak commented 8 years ago

You have a JS error in that page, you're missing a comma in the options object.

screen_shot_2016-06-16_at_11_58_47_am

I'll close this issue because it seems to me that you're not dealing with a library error.

Please create a StackOverflow question to ask for help on how to use this script.

antonygravett commented 8 years ago

OK, I understand why you are closing this out, but I think SO is a long shot to get this working ... the last inquiry was on Jan 28 and didn’t relate to the accessToken issue, afaict.

I uploaded modified versions of the two test files (each with different client IDs and access tokens) and there’s still no joy. I also changed the jquery.min.js script to a remote one, just to see if that would solve the TypeError: undefined is not an object (evaluating 'a.length’) that shows up for that file, but it didn’t change anything:

http://corduroyshop.com/instagram-feeds/160616-instagram-left-1.html http://corduroyshop.com/instagram-feeds/160616-instagram-left-2.html

Two questions:

  1. Can I hire you to fix this for me? PayPal?
  2. Do you plan to provide a working piece of sample code with this library that includes the new syntax? For those of us who only occasionally dabble in js/jQuery, that would be helpful! As it is, I don’t know if it is a code error, an authentication error or something else that is causing the non-display of images, and my client is fuming (naturally). Thanks for anything additional you can throw my way.
antonygravett commented 8 years ago

Not meaning to be snarky, but your “home” page is also not displaying any images

Thanks so much for being willing to accommodate an inexperienced coder such as myself!