title: react-google-login clears the cookie/session information in my app
body: <p>I have setup authentication in my app using <a href="https://www.npmjs.com/package/react-google-login" rel="nofollow noreferrer">https://www.npmjs.com/package/react-google-login</a>. I am unable to figure out why the session/cookie information disappears in my application when I reload the page. That is logged in users reloading the page will be logged out :(</p>
  <p>Here is my code in my application's Login component:</p>
  <pre><code>const Login = () =&gt; {
    const [user, setUser] = useContext(UserContext);
  
    const onSuccess = (response) =&gt; {
      axios.post(API_ONE, {
        name: response.profileObj.name,
      });
  
      axios.post(API_TWO, {
        email: response.profileObj.email,
      });
  
      navigate(&quot;/&quot;);
      setUser({
        id: response.profileObj.email,
        userLoggedIn: true,
      });
    };
  
    const { signIn } = useGoogleLogin({
      onSuccess,
      clientId: CLIENT_ID,
      isSignedIn: true
    });
  
    return (
      &lt;div&gt;
        &lt;button onClick={signIn}&gt;&lt;/button&gt;
      &lt;/div&gt;
    );
  };
  
  export default Login;
  
  </code></pre>
  <p>I can confirm that react-google-login preserves the session information when I try to test the functionality in isolation in a simple demo application.</p>
  <p>I spent significant time trying to figure out why this is happening but no luck yet. I would appreciate if someone could help me with any troubleshooting/debugging tips or suggest alternate ideas that I could do to achieve the authentication functionality and preserving the session on refresh.</p>
  <p>EDIT:</p>
  <ol>
  <li><p>In the simple demo app(<a href="https://github.com/Sivanesh-S/react-google-authentication" rel="nofollow noreferrer">https://github.com/Sivanesh-S/react-google-authentication</a>) I opened the applications tab and network tab in parallel and then when I try to refresh after login, I can see the network requests to accounts.google.com. After this network requests, I can see the local storage, cookies and session information persist in the applications tab.</p>
  </li>
  <li><p>In my application when I try to refresh after login, <strong>I cannot see the network requests to accounts.google.com</strong>.
  The local storage, cookies and session information gets cleared in the applications tab</p>
  </li>
  </ol>
  <pre><code>{
    &quot;name&quot;: &quot;my-app&quot;,
    &quot;version&quot;: &quot;1.0.0&quot;,
    &quot;main&quot;: &quot;src/App.js&quot;,
    &quot;dependencies&quot;: {
      &quot;@reach/router&quot;: &quot;^1.3.3&quot;,
      &quot;axios&quot;: &quot;^0.19.0&quot;,
      &quot;react&quot;: &quot;^16.13.1&quot;,
      &quot;react-dom&quot;: &quot;^16.12.0&quot;,
      &quot;react-google-login&quot;: &quot;^5.1.21&quot;,
      &quot;react-router-dom&quot;: &quot;^5.2.0&quot;,
      &quot;react-scripts&quot;: &quot;0.9.5&quot;
    },
    &quot;devDependencies&quot;: {
      &quot;babel-eslint&quot;: &quot;^10.1.0&quot;,
      &quot;eslint&quot;: &quot;^7.12.0&quot;,
      &quot;eslint-config-prettier&quot;: &quot;^6.14.0&quot;,
      &quot;eslint-plugin-import&quot;: &quot;^2.22.1&quot;,
      &quot;eslint-plugin-jsx-a11y&quot;: &quot;^6.3.1&quot;,
      &quot;eslint-plugin-react&quot;: &quot;^7.21.5&quot;,
      &quot;parcel-bundler&quot;: &quot;^1.12.4&quot;
    },
    &quot;scripts&quot;: {
      &quot;dev&quot;: &quot;parcel src/index.html&quot;,
      &quot;clear-build-cache&quot;: &quot;rm -rf .cache/ dist/&quot;,
      &quot;format&quot;: &quot;prettier \&quot;src/**/*.{js, html}\&quot; --write&quot;,
      &quot;lint&quot;: &quot;eslint \&quot;src/**/*.{js,jsx}\&quot; --quiet&quot;
    }
  }
  </code></pre>