Instagram登录hello.js

时间:2017-08-02 19:31:15

标签: javascript hello.js

我尝试使用hello.js登录instagram,但它从不指向https://api.instagram.com/oauth/authorize,否则会立即指向我的重定向网址,因此我无法获取访问令牌。这是我的代码:

    hello('instagram').login({redirect_uri : instagram_redirect_url, 
    scope: 'basic, publish'}, function(e){
                if(e.error){

                }else{
                    var instagram_access_token = 
    hello('instagram').getAuthResponse().oauth_token;
                    var instagram_secret = 
    hello('instagram').getAuthResponse().oauth_token_secret;
                    console.log(instagram_access_token);
                    console.log(instagram_secret);
                }
            });
    hello.init ({
        instagram: instagram_client_id
    });

1 个答案:

答案 0 :(得分:0)

我发现我必须将response_type更改为token

hello.init(
    {
        instagram: INSTAGRAM_ID
    },
    {
        redirect_uri: helloOAuthCallback,
        popup       : {
            location: 'no'
        },
        oauth_proxy : oauthproxy_url,
        response_type: 'token'
    }
);

现在它对我有用。