Click here to Skip to main content
15,892,072 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
I want to put a simple gallery which retrieves photos from instagram to my web site. I got my access token from instagram manually (ttps://instagram.com/oauth/authorize/?client_id=[CLIENT_ID_HERE]&redirect_uri=http://localhost&response_type=token). And it is works fine with simple java sript and ajax but my complain is How long this access token will be valid ? Now it works fine but should I do something on back end ?

What I have tried:

https://instagram.com/oauth/authorize/?client_id=[CLIENT_ID_HERE]&redirect_uri=http://localhost&response_type=token

I typethe above URL to browser then get my acces token manually then use it in my ajax call.
Posted
Updated 21-May-16 0:43am

1 solution

Start with the documentation: Instagram Developer Documentation[^] which says:
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=OAuthAccessTokenError". In this case you will need to re-authenticate the user to obtain a new valid token.

Which means that they don't normally expire at all, but you need to detect when they do and repeat your manual procedure to get a new one.
 
Share this answer
 
Comments
Ermany 21-May-16 7:13am    
Thank you for your quick reply. Actually I read the documentation but I want be sure from users experiences(May be some one knows the period of time that they reset the access token If it is like every years I may think the manual way ). So I decided to write a method to my controller which gets access token every page called ...

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900