Instagram API访问令牌有效期多长? [英] How long is instagram API access token valid ?

查看:105
本文介绍了Instagram API访问令牌有效期多长?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想放一个简单的图库,用于检索从Instagram到我网站的照片。我手动从Instagram获取了访问令牌(ttps://instagram.com/oauth/authorize/?client_id = [CLIENT_ID_HERE]& redirect_uri = http:// localhost& response_type = token)。并且它可以很好地使用简单的java sript和ajax,但我的抱怨是这个访问令牌有效多长时间?现在它工作正常,但我应该在后端做点什么吗?



我尝试过的事情:



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



我输入上面的浏览器URL然后手动获取我的访问令牌,然后在我的ajax调用中使用它。

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.

推荐答案

从文档开始:Instagram Developer Documentation [ ^ ]说:

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.


这篇关于Instagram API访问令牌有效期多长?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆