Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Instafeed token not working #747

Open
monzanifabio opened this issue Sep 17, 2022 · 2 comments
Open

Instafeed token not working #747

monzanifabio opened this issue Sep 17, 2022 · 2 comments

Comments

@monzanifabio
Copy link

I have been using Instafeed for nearly a year and from time to time I would have to generate a new token.
Although after trying that yesterday Instafeed seems not to be working and doesn't pull any images.
From the console I get the following errors:
Failed to load resource: the server responded with a status of 400 ()
Error: api request error: 190 Error validating access token: The session has been invalidated because the user changed their password or Facebook has changed the session for security reasons.

@MattBudz
Copy link

MattBudz commented May 2, 2023

I would run into this all the time. At first, I set a schedule where my app would refresh the token once every N days but it would still catch me off guard where the token would expire before the Nth day.

Now, I refresh my token every time the feed loads on the page

    const accessToken = <your API access token here>
    $.ajax({
      type: 'get',
      url:
        'https://graph.instagram.com/refresh_access_token?grant_type=ig_refresh_token&access_token=' +
        accessToken,
    });

To be clear, this doesn't change the token, it just refreshes its validity. Facebook likes to disable/invalidate tokens after N days, this pings FB to refresh the validity of the token. I have been using this method for over a year and haven't had any more errors due to invalid tokens.

@monzanifabio
Copy link
Author

@MattBudz nice one!
Thanks for this, I'll try it out.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants