0

我在 vue.js 前端工作。如果我使用匿名身份验证,我可以成功调用缝合并写入数据库。当我切换到 Google oauth 并尝试对数据库进行相同的写入调用时,我收到以下错误:

uncaught exception: t: (MustAuthenticateFirst): method called requires being authenticated

我已经在 Stitch 管理控制台中设置了 Google 身份验证提供程序。我在 Google Cloud Platform 上创建并配置了一个项目。在我的 vue 代码中,我添加了一个运行此代码段的“使用 google 登录”按钮:

  loginWithGoogle() {
    const googleCredential = new GoogleRedirectCredential();
    client.auth.loginWithRedirect(googleCredential);
  },

当我点击登录时,我被重定向到谷歌表单并被谷歌要求登录,然后成功重定向回我的应用程序。但是当我尝试写入缝合数据库时,它仍然说我必须先进行身份验证。

4

1 回答 1

0

当谷歌重定向回你的应用程序时,你会调用 de hasRedirectResult() 和 handleRedirectResult() 吗?此方法在本地存储凭据(我在 localstorage 中来宾)。

于 2018-08-21T17:38:31.857 回答