Google Plus在localhost上登录Cookie政策

Jon*_*Jon 2 javascript google-plus

我正在使用本指南整理一个使用google plus signin的webapp .

我正在运行webapp 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'
    });
Run Code Online (Sandbox Code Playgroud)

如果我将我的cookiepolicy更改为'http:// localhost:8888',我会得到:

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

请求详情

response_type =代码令牌id_token gsession scope = https://www.googleapis.com/auth/plus.login redirect_uri = postmessage access_type = offline 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 authuser = 0

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

Bre*_*ttJ 7

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