没有使用Google凭据从流星项目登录



我正在在流星上进行网站,并且在使用Google登录时遇到了问题。当用户单击按钮时,我的网页确实正确登录,询问您的电子邮件和密码,并且它确实可以从我的网页上正确登录。问题在于,某种程度上,我的页面使流星将USERID保持在流星中,下次我单击登录按钮时,它不会要求我输入密码。此外,弹出后,如果我尝试在YouTube,Gmail或其他任何内容上登录,它将使用我刚刚从网页登录的帐户登录。知道为什么会发生这种情况?

我试图在注销函数上添加此代码,但不起作用:

Template.user_loggedin.events({
"click #logout": function (e, tmpl) {
    Meteor.logout(function (err) {
        if (err) {
            //An error occured
            Bert.alert('Error al cerrar sesión. Por favor, vuelva a intentarlo', 'warning', 'fixed-top', 'fa-remove');
        } else {
            // your cleanup code here
            Object.keys(Session.keys).forEach(function (key) {
                Session.set(key, undefined);
            });
            Session.keys = {}; // remove session keys
            Router.go('/');  // redirect to the home page or elsewhere using iron:router
            Bert.alert('Cerrado sesión correctamente', 'success', 'fixed-top', 'fa-check');
            }
        });
    }
});

我从这里拿了这个代码,但我不确定是否是同一问题。

这是我的登录功能:

Template.user_loggedout.events({
    "click #login": function (e, tmpl) {
        e.preventDefault();
        Meteor.loginWithGoogle({
            //Show what information is needed from the user
            requestPermissions: ['profile', 'email', 'https://www.googleapis.com/auth/spreadsheets']
        }, function (err) {
            if (err) {
                Session.set('errorMessage', err.reason || 'Unknown error');
                Bert.alert('Error al Iniciar Sesión. Por favor, vuelva a intentarlo', 'warning', 'fixed-top', 'fa-remove');
            } else {
                Bert.alert('Iniciado sesión correctamente', 'success', 'fixed-top', 'fa-check');
            }
        });
    }
});

我不是100%确定的,但是基本上,通过使用Google身份验证,您正在告诉流星推迟Google进行身份验证。

因此,当您从流星登录时,它会破坏本地存储中的登录令牌,在那里做正确的事情。

但是,如果您不登录Google,则在您再次运行应用程序时,流星只需与Google查看以查看您是否已登录,因此可以让您进入。

我认为这是一个功能,而不是错误。

最新更新