【发布时间】:2014-09-26 07:53:05
【问题描述】:
我的要求如下。
我在页面create.html 我想触发一个弹出窗口说Login with Instagram。当用户单击该弹出窗口时。我想在像 facebook 这样的弹出窗口上对用户进行身份验证,并在不重新加载的情况下在同一页面上获取访问令牌。当我在附加图片时,我将从 instagram 中获取已经包含来自 facebook 的图片的 div,如果我刷新这些图片将会丢失。
我已成功触发请求并获得该访问令牌。但我不确定如何在 ajax 请求中获取类似成功函数的令牌。
要求:
https://api.instagram.com/oauth/authorize/?client_id=XXX&redirect_uri=http://localhost:3000/auth/instagram/callback&response_type=code
分辨率:
http://localhost:3000/auth/instagram/callback?code=XXXX
如何在我的 create.html 中获取 code=XXXX?
我只能使用 javascript 和 jquery。节点?不!
我尝试使用这个库。 https://github.com/Instagram/instagram-javascript-sdk 但它给了我错误。 {"code": 400, "error_type": "OAuthException", "error_message": "JS login temporarily disabled"}.
如果有任何方法可以像 facebook 一样获得这个令牌。(下)
FB.login(
function (response) {
if (response.authResponse) {
access_token = FB.getAuthResponse()['accessToken'];
new facebookLogin(access_token);
}
}
);
或以任何方式获取该 URL code=XXXX。请帮帮我。
谢谢。
【问题讨论】:
标签: javascript jquery authentication oauth-2.0 instagram