4

I am using instafeed.js like so:

var feed = new Instafeed({
        get: 'user',
        userId: 19191919191,
        limit: 9,
        accessToken: 'myaccesstokenhere',
        target: 'instagram',
        resolution: 'standard_resolution',
        after: function() {
            var el = document.getElementById('instagram');
            if (el.classList)
                el.classList.add('show');
            else
                el.className += ' ' + 'show';
        }
});

but I am getting this error:

The access_token provided is invalid.

I got the access_token by https://www.instagram.com/developer I registered my application and put the Client Secret as the accessToken and I got my userID from here https://smashballoon.com/instagram-feed/find-instagram-user-id/

but its still saying The access_token provided is invalid. what am I doing wrong?

user979331
  • 10,209
  • 56
  • 186
  • 339
  • From the docs: `Even though our access tokens do not specify an expiration time, your app should handle the case that either the user revokes access, or Instagram expires the token after some period of time. If the token is no longer valid, API responses will contain an “error_type=OAuthAccessTokenException”. In this case you will need to re-authenticate the user to obtain a new valid token. In other words: do not assume your access_token is valid forever.` https://www.instagram.com/developer/authentication/ – Rory McCrossan Jan 22 '18 at 15:07
  • I did that, I created a whole new application and token. – user979331 Jan 22 '18 at 15:24
  • It has been answered here, take a [look](https://stackoverflow.com/questions/37609974/instagram-api-the-access-token-provided-is-invalid). – Marco Jan 24 '18 at 17:47

2 Answers2

4

You cannot use your Client Secret in place of accessToken, as the Client Secret is used server-side as part of the OAuth process in order to get the user accessToken.

I suggest reviewing Instagram's Authentication docs here to be sure you're using the Authentication strategy that makes sense for your application.

It sounds like you're more likely to want to use their Client Side Implicit Authentication (at the bottom) to get an access token. You can even do this yourself manually to just get an accessToken for testing. Once you have the accessToken, then you can simply use that in the correct field for instafeed.js to load what you want from Instagram.

You can also just get your own accessToken by going to http://instagram.pixelunion.net/ and using the one generated there.

mootrichard
  • 3,350
  • 11
  • 25
0

Seems you confused accessToken with Client Secret, check it here https://www.instagram.com/developer/authentication/

To make life easy you can try to generate one here http://instagram.pixelunion.net/

Maidul
  • 290
  • 1
  • 7