无法在Meteor应用程序中使用Google登录

时间:2015-10-05 08:53:55

标签: meteor oauth google-oauth

为了进行测试,我制作了一个超级简单的流星应用程序,允许用户使用Google登录。

main.html中:

<head>
    <title>OAuth test</title>
    <meta charset="utf-8">
</head>
<body>
    {{> user}}
    {{> loginButtons}}
</body>
<template name="user">
    {{user}}
</template>

main.js:

Template.user.helpers({
    user: function() {
        var user = Meteor.user() || "Cake";
        return JSON.stringify(user);
    }
});

我安装了accounts-uiaccounts-google个软件包,并使用clent ID,客户端密码,允许的JS来源和重定向网址配置了google登录信息。

点击&#34;使用Google登录&#34; loginButtons中的按钮显示弹出窗口,我应该输入我的用户名和密码,并询问我的应用程序是否可以查看我的电子邮件地址和基本配置文件信息。点击&#34;允许&#34;为此简要显示了网页&#34; http://myapp.example.com/_oauth/google&#34;用文本&#34;登录完成。 ...&#34;在关闭窗口之前。但是,user模板仍然只打印&#34; Cake&#34;,我还没有登录。数据库中的users集合中没有条目。

流星控制台打印出来:

W20151005-10:01:46.344(2) (oauth_server.js:71) Unable to base64 decode state from OAuth query: undefined
W20151005-10:01:46.346(2) (oauth_server.js:71) Unable to base64 decode state from OAuth query: undefined
W20151005-10:01:46.346(2) (oauth_server.js:398) Error in OAuth Server: Failed to complete OAuth handshake with Google. failed [400] {   "error" : "invalid_grant" }

知道可能出错的是什么?我唯一能想到的是我的应用程序在HTTP上运行,而不是HTTPS,在这种情况下,错误消息非常糟糕......

PS: 在撰写此问题时,我安装了accounts-github并对其进行了配置。结果几乎相同:

W20151005-10:49:38.748(2) (oauth_server.js:71) Unable to base64 decode state from OAuth query: undefined
W20151005-10:49:38.750(2) (oauth_server.js:71) Unable to base64 decode state from OAuth query: undefined
W20151005-10:49:38.750(2) (oauth_server.js:398) Error in OAuth Server: Failed to complete OAuth handshake with GitHub. bad_verification_code

0 个答案:

没有答案