Search code examples
javascriptgoogle-apigoogle-openid

login with google stopped working cookiepolicy is a required field


I'm using google sign in js in my web application, I was using these 3 statements in meta data

    <meta name="google-signin-clientid" content="1111111111111111111.apps.googleusercontent.com" />
    <meta name="google-signin-scope" content=https://www.googleapis.com/auth/plus.login https://www.googleapis.com/auth/plus.profile.emails.read" />
    <meta name="google-signin-cookiepolicy" content="single_host_origin" />

suddenly It stopped working and give me this error cookiepolicy is a required field

The idea that the site was working without problems!


Solution

  • The solution that google no more recognize cookiepolicy in meta data. you must put it in the params of the gapi.auth.signIn

        var additionalParams = {
                'callback': signinCallback,
                'cookiepolicy' : 'single_host_origin'
            };
    
        gapi.auth.signIn(additionalParams);