我正在尝试将用户最近的Instagram媒体放在侧边栏上。我正在尝试使用Instagram API来获取媒体。
http://instagram.com/developer/endpoints/users/
该文档说GET https://api.instagram.com/v1/users/<user-id>/media/recent/
,但说要传递OAuth访问令牌。访问令牌表示代表用户执行操作的授权。我不希望用户登录Instagram在侧栏上看到它。他们甚至不需要拥有Instagram帐户。
例如,我可以不登录Instagram即可访问http://instagram.com/thebrainscoop。我想通过API做到这一点。
在Instagram API中,未经用户身份验证的请求传递client_id
而不是access_token
。但是,如果尝试这样做,则会得到:
{
"meta":{
"error_type":"OAuthParameterException",
"code":400,
"error_message":"\"access_token\" URL parameter missing. This OAuth request requires an \"access_token\" URL parameter."
}
}
那么,这不可能吗?在不要求用户首先通过OAuth登录Instagram帐户的情况下,是否无法获取用户的最新(公共)媒体?
这已经很晚了,但是如果它可以帮助某人是值得的,因为我在Instagram的文档中没有看到它。
要https://api.instagram.com/v1/users/<user-id>/media/recent/
(在撰写本文时)执行GET,实际上您不需要OAuth访问令牌。
你可以表演 https://api.instagram.com/v1/users/[USER ID]/media/recent/?client_id=[CLIENT ID]
[客户ID]是通过管理客户端在应用中注册的有效客户端ID(与用户无关)。您可以通过执行GET用户搜索请求从用户名中获取[USER ID]:https://api.instagram.com/v1/users/search?q=[USERNAME]&client_id=[CLIENT ID]
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句