Javascript 从主干网获取Instagram访问令牌

Javascript 从主干网获取Instagram访问令牌,javascript,backbone.js,instagram,Javascript,Backbone.js,Instagram,我正在通过主干网开发一个移动应用程序。我需要在Instagram中验证用户身份。Instagram返回使用url重定向我的访问令牌,此url中有我的访问令牌 例如,我已转到以下url: window.location.replace("https://instagram.com/oauth/authorize/? client_id=e40f15a****8a66&redirect_uri=http://example.com&response_type=token"); I

我正在通过主干网开发一个移动应用程序。我需要在Instagram中验证用户身份。Instagram返回使用url重定向我的访问令牌,此url中有我的访问令牌

例如,我已转到以下url:

window.location.replace("https://instagram.com/oauth/authorize/?  client_id=e40f15a****8a66&redirect_uri=http://example.com&response_type=token");
Instagram将我重定向到example.com,并附加我的访问令牌:

www.mysite.com#accesstoken=125424
如何在主干网中管理和获取我的访问令牌

路由器能截获这个url吗

这是我的路由器函数,它调用url对用户进行身份验证:

var AppRouter = Backbone.Router.extend({
routes: {
        "": "prova",

        "aut":"provaaut",

    },



   provaaut: function(){





  window.location.replace('https://instagram.com/oauth/authorize/?client_id=e40f15a905**66&redirect_uri=http://example.coml&response_type=token');

AFTER WINDOW.LOCATION.REPLACE instagram redirect me to e new url containing token
   HERE I NEED TO GET REDIRECTED URL

   },

在javascript中是否有办法转到url等待重定向并获取新的url?

我在一个驱动器验证API中遇到了同样的问题。我用正则表达式解决了这个问题

您是否可以将重定向url设置为以下内容?www.mysite.com/#accesstoken=125424

下面的代码应该可以工作:

       routes : {

            "*default"                  : "index"
        },

       initialize : function() {

            $_ = this;

            $_ .route(/^accesstoken/, "token_redirect");
        },

       token_redirect : function(){
               //do your stuff
        }

您是否尝试指定为路由<代码>路由:{'accesstoken=:token':'instagramAuthReturned'}是的,我做了,但不起作用。问题是route应该获得以下url:www.mysite.com#accesstoken=125424。但它不能保持它和我的页面更改,因为它是一个redirect@colllinPlease发布更多代码,展示您尝试过的解决方案。