cosenary / Instagram-PHP-API

An easy-to-use PHP Class for accessing Instagram's API.
http://cosenary.github.com/Instagram-PHP-API
BSD 3-Clause "New" or "Revised" License
1.46k stars 782 forks source link

How to login automatically #77

Open deryckoe opened 9 years ago

deryckoe commented 9 years ago

Hello,

I make the Class work, but I have to manually login every time I load the website. That it´s not a very practical solution. I would like to know if there´s and implemented way of auto login with every page load. The final users, does not need to manually load, only need to see the Instagram media feed.

I would like to thanks for your great work, of course. That´s my only issue, the Class works perfect.

Any suggestion or example? Thanks.

cosenary commented 9 years ago

Hi! Thanks for your kind words. I just updated the Example-Project Gist for you, in order to work with sessions (the user-token will be stored in the session, so that the user stays logged in).

I'll update the Example-Project in the upcoming V3 release.

Cheers, Christian

deryckoe commented 9 years ago

Hi Christian,

Thanks for your help. I solve that with a solution similar like you. I admit, take a while to think on store the token (I never work before with Instagram API) but I made it saving the token, just like you. The code works fine thanks you very much and Happy Holidays.

Cheers, Deryck.

Q8HMA-zz commented 9 years ago

Hello

how can i used the code for multi days like take one "getOAuthToken" and used it for unlimited time ??

thanx

RobWiddick commented 9 years ago

@Q8HMA Store the token in a database and use it whenever. But don't assume it'll always be active.

bravokeyl commented 9 years ago

@robertark , is using cookies to store access token a good way ? How can we know when that token is inactive? Thanks

bravokeyl commented 9 years ago

@robertark , sorry got it ...“error_type=OAuthAccessTokenError” is set in response if access token is inactive

RobWiddick commented 9 years ago

Cookies are stored on the client... might as well have them go through the OAuth process again (it's fast anyways). You store the access token on the server if you ever want to access the users info again - such as via a CRON job.