javascriptjqueryinstagraminstagram-apiinstafeedjs

instafeed.js stopped working: The access_token provided is invalid


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?


Solution

  • 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.