【问题标题】:How to implement google oauth in cakephp using cakedc/users?如何使用 cakedc/users 在 cakephp 中实现 google oauth?
【发布时间】:2017-09-26 09:21:50
【问题描述】:

我正在尝试通过使用linkedin 和google 的CakeDC/users 插件添加登录层。 linkedin 登录工作正常,但我无法弄清楚谷歌登录。遵循教程中的所有内容login with google oauth

我在从 google/auth 返回的 url 中得到一个代码参数,但参数 authuser 的值返回为 0。

在developers.google 网站上,我发现如果返回代码参数,则应用已通过身份验证。

没有用户被添加到 users 表中,且 social_accounts 表中也没有发生任何更改,并且会显示一条消息为“您无权访问该位置”。

【问题讨论】:

    标签: cakephp oauth-2.0 google-authentication cakedc


    【解决方案1】:

    为了让 Google OAuth 正常工作,您需要在凭据 (https://console.developers.google.com/) 下生成 OAuth 2.0 客户端 ID。

    然后您需要在控制面板下启用 Google+ API(这是您可能错过的步骤)。如果您不启用 API,Google 将不会返回用户详细信息,您将遇到您描述的行为。

    【讨论】:

    • 谢谢,我没有像你猜的那样启用google plus api。
    猜你喜欢
    • 1970-01-01
    • 2018-11-29
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2014-05-07
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多