【发布时间】:2016-09-07 18:08:48
【问题描述】:
我正在使用 angularJs 并提供一个按钮让用户授权 Instagram。
我可以通过传递https://api.instagram.com/oauth/authorize/?client_id=CLIENT-ID&redirect_uri=REDIRECT-URI&response_type=token来测试我在redirectUrl中得到accessToken。
问题是如何在 angularJs 按钮单击中调用此流程。目前我所拥有的如下:
html
授权给 Instagram
js
app.controller('AdminController', ['$scope', function($scope){
...
this.authorizeIg = function(){
console.log('start of authorizeIg implict flow');
window.location.href = "https://api.instagram.com/oauth/authorize/?client_id=CLIENT-ID&redirect_uri=REDIRECT-URI&response_type=token";
};
上面只会在身份验证后将我重定向到redirect_url。所以,我不知道如何在函数中调用该 url 并返回包含 accessToken 的响应
【问题讨论】:
标签: javascript angularjs oauth-2.0 instagram-api