title: How to use loopback IP to retrieve auth token
body: <p>Recently Google banned embedded browser auth in favor of <a href="https://developers.google.com/identity/protocols/OAuth2InstalledApp#redirect-uri_loopback" rel="nofollow noreferrer">Loopback IP</a> approach</p>
  
  <p>My site has a desktop client that uses the same login system as the web site. Basically I pop a embedded browser view to my website and grab the cookie after login is done. The auth cookie for my site is then used for API access by the desktop client. </p>
  
  <p>Now that Google bans embedded browser I need a new approach for this (if I want to maintain Google external login). </p>
  
  <p>If I understand it right then the new process would be something like<br>
  1. Desktop client listen to <code>localhost::port</code><br>
  2. Desktop client launches Url to the website's login page and opens user's default browser<br>
  3. User login to the website using their favorite browser<br>
  4. web server detects login success and  somehow sends a redirect with the auth token to <code>localhost::port</code><br>
  5. Desktop client reads the token from localhost</p>
  
  <p>But how can I show the login success page to instruct user to close the browser and return to the desktop app if the redirect URL is localhost? How should I implement this on both the server and desktop client?</p>