Why am I getting the “SameSite” attribute set to “None” or an invalid value, without the “secure", error when trying to implment Gmail Oauth

Viewed 428

Errors

Cookie “G_AUTHUSER_H” will be soon rejected because it has the “SameSite” attribute set to “None” or an invalid value, without the “secure” attribute. To know more about the “SameSite“ attribute, read https://developer.mozilla.org/docs/Web/HTTP/Headers/Set-Cookie/SameSite cb=gapi.loaded_0:159:401

Cookie “G_AUTHUSER_H” will be soon rejected because it has the “SameSite” attribute set to “None” or an invalid value, without the “secure” attribute. To know more about the “SameSite“ attribute, read https://developer.mozilla.org/docs/Web/HTTP/Headers/Set-Cookie/SameSite cb=gapi.loaded_0:159:401

Cookie “G_ENABLED_IDPS” will be soon rejected because it has the “SameSite” attribute set to “None” or an invalid value, without the “secure” attribute. To know more about the “SameSite“ attribute, read https://developer.mozilla.org/docs/Web/HTTP/Headers/Set-Cookie/SameSite cb=gapi.loaded_0:273:21

Problem


So I've been trying to use the Gmail Oauth API to set up logins into my website. It was working fine on my localhost just of XAMPP but once one of my team members tried to move the website off of XAMPP onto a Node Js server. It would refresh constantly if you logged in using your gmail.

Without the gmail Oauth the website seems to work fine it is just when I try use it.

1 Answers

I managed to fix the problem with the google refreshing the page by only loading the logIn function if I was on the logIn page. Otherwise, it was just running the function over and over again on other pages.

Maybe not the best solution but this is what I did.


        //loads if page is login.html
        switch (current) {
            case "http://localhost:2000/login.html":
                window.location.href = "./index.html"
                console.log("Note on page");
                break;
        }
Related