【问题标题】:meteor get google accesstoken after redirect流星重定向后获取谷歌访问令牌
【发布时间】:2015-07-01 03:56:34
【问题描述】:

我正在我的应用中实现邀请人,我想使用谷歌联系人,

如果我使用accounts-google包来验证用户,这将是一个复杂的过程,因为我不想存储用户信息,

我只想要一次身份验证,所以我正在寻找客户端解决方案,

    var url='https://accounts.google.com/o/oauth2/auth?scope=https://www.googleapis.com/auth/contacts.readonly&client_id=5558545-3n8vg6u4nu2hm1gmuj1dbjib28p33qss.apps.googleusercontent.com&redirect_uri=http://localhost:3000/_oauth/google&response_type=token'
var newWindow = window.open(url, 'name', 'height=600,width=450');

点击邀请按钮后,我称它运行良好,但如何阅读此窗口返回的accesstoken

我找不到怎么做?

我尝试使用HTTP 方法

HTTP.get(url, {}, function(e,r){
        console.log(e,r);
      });

但它抛出错误,它不工作。

如何从弹出窗口中读取 accesstoekn?或者有没有其他方法可以做到这一点?

【问题讨论】:

    标签: javascript meteor oauth google-oauth


    【解决方案1】:

    我已经做到了。 如果你需要溶胶,请告诉我,因为它有点长。但我没有打包和原始实现

    【讨论】:

      【解决方案2】:

      window.location.hash 包含 URL 的片段部分。

      【讨论】:

        猜你喜欢
        • 2017-11-13
        • 2016-04-19
        • 1970-01-01
        • 2017-04-23
        • 2018-09-25
        • 2021-01-29
        • 2013-07-20
        • 2016-10-05
        • 1970-01-01
        相关资源
        最近更新 更多