Google API/OAUTH/NativeApplicationClient/OAuth2Aut

2019-06-05 22:37发布

问题:

I'm building a desktop app that connects to Googles APIs using OATH following the scheme found in this thread:

Google API v3 for dotnet; using the calendar with an API key

And all works fine. I have build a form that shows a WebBrowser to collect the authCode.

But how do I implement "Logout"? Can't find any API functionality for this.

回答1:

Niels, you can do the following things.

  1. Log the user out of Google in the WebBrowser control by going to this URL (https://accounts.google.com/Logout?hl=en)
  2. You can revoke the users Token by calling https://accounts.google.com/o/oauth2/revoke?token={token}
  3. You can further remove cookies, etc from webbrowser by calling You can Delete cookies by calling System.Diagnostics.Process.Start("rundll32.exe","InetCpl.cpl,ClearMyTracksByProcess 2")