Google Plus 在本地主机上登录 Cookie 政策

Google Plus Sign In Cookie Policy on localhost

本文关键字:登录 Cookie 政策 主机 Plus Google      更新时间:2023-09-26

我正在整理一个使用谷歌的网络应用程序,并使用本指南登录。

我正在localhost:8888上运行网络应用程序。

像这样使用javascript,事情工作正常:

    gapi.signin.render(thisHandle.details.buttonId, {
        'callback': mySignIn,
        'clientid': myClientId,
        'requestvisibleactions': 'http://schemas.google.com/AddActivity',
        'scope': 'https://www.googleapis.com/auth/plus.login',
        'theme': 'light',
        'cookiepolicy': 'single_host_origin',
        'accesstype': 'offline'
    });

如果我将我的 cookiepolicy 更改为"http://本地主机:8888",我会得到:

错误:invalid_request 授权不严格在公共后缀下: localhost :8888

请求详细信息

response_type=代码令牌 id_token gsession scope=https://www.googleapis.com/auth/plus.login redirect_uri=发布消息access_type=脱机 cookie_policy=http://localhost :8888 proxy=oauth2relay874392806 origin=http://localhost :8888 state=384885884|0.12629541 client_id=[我的客户端 ID] request_visible_actions=http://schemas.google.com/AddActivity 身份验证用户=0

在这种情况下,就存储用户和会话信息而言,不严格在公共后缀下的权限意味着什么?是否有解决方法可以让我运行我的开发服务器?任何帮助非常感谢。

对于您的开发工作,您可以坚持使用single_host_origin或使用none(效率较低)。当您的登录用户可能通过多种协议(http & https)或使用子域(www.example.com 和 support.example.com)访问您的网站时,Cookie 政策更为重要。在这些情况下,您可能希望使用http://example.com 的 cookiepolicy