Google Sign-In Button sends Post requests to play.google.com with 401 code response

Viewed 51

I have a Google Sign In Button in my App. And it works fine. But if user is not authorized (default state), I have an error message in console.

enter image description here

My app doesn't use any play.google.com services. Why it's trying to connect to it? And how to disable this?

Code, that render button:

React.useEffect(() => {
    const script = document.createElement("script");
    script.src = "https://accounts.google.com/gsi/client";
    script.id = "google-client-script";
    const buttonRef = googleButtonRef.current!;
    script.onload = () => {
      if (
        window !== undefined &&
        window.google !== undefined &&
        buttonRef !== null
      ) {
        window.google.accounts.id.initialize({
          client_id: clientId,
          callback: handleCredentialResponse, // get auth response
        });
        window.google.accounts.id.renderButton(
          buttonRef,
          { type: "icon", shape: "circle" } // customization attributes
        );
      }
    };
    script.async = true;
    document.body.appendChild(script);}, 
[]);
0 Answers
Related