totemstech/instagram-node

OAuthAccessTokenException: The access_token provided is invalid

mattfiocca opened this issue · 5 comments

We're seeing this in our logs all of a sudden:

OAuthAccessTokenException: The access_token provided is invalid

Here's how we're using this module:

var ig = require('instagram-node').instagram();
ig.use({
    client_id: config.instagram.client_id,
    client_secret: config.instagram.client_secret
});
ig.tag_media_recent('cats', function(err, medias, pagination, remaining, limit){
    console.log(err); // <- HERE
});

To be honest, we've been using this a while now, and I just learned that the IG API has undergone some auth changes. What are we missing here?

Thanks in advance.

see : #98

You must revalidate your users tokens

So, the way we've been using this, we don't have users at all, and we've just been aggregating public instagrams. Is this no longer a thing?

sorry, i answered you too quickly.

Ithink the API now require user authentication for every endpoints. You can not use it without an user account anymore.

From the API documentation :

The Instagram API requires authentication - specifically requests made on behalf of a user. Authenticated requests require an access_token. These tokens are unique to a user and should be stored securely. Access tokens may expire at any time in the future.

https://www.instagram.com/developer/endpoints/tags/

Has this issue been resolved?

This worked for me, just add the token, or override the req with your own, instead of calling instagram.user(), make your own call. Thats I did till this gets fixed.

call('GET', '/users/' + id, {access_token:'Token'}, function(err, result, remaining, limit) {
if(err) {
return handle_error(err, cb, retry);
} else if(result && result.meta && result.meta.code === 200) {
return cb(null, result.data, remaining, limit);
} else {
return handle_error(result, cb, retry);
}
}, retry);