Do not do without a web browser.
If the user is not logged in for google (or any other provider), he must first authorize with the provider. This is done through a web browser, and you should not even try to do it in any other way (for security reasons, the user must be sure that he is connected to the provider, for example, by seeing the URL in his browser).
However, even if the user is logged in, the provider should know this - usually with a cookie. Cookies are stored in a web browser. Therefore, theoretically, you can analyze the browser cookie and then try immediate authentication, but this will not work until you log in and authorize the relying party first through a web browser.
source share