1

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.

Community
  • 1
  • 1
Niels Bosma
  • 11,758
  • 29
  • 89
  • 148
  • 1
    Just throw away the access and refresh tokens? – Jan Gerlinger Oct 01 '12 at 15:06
  • This works. But the user isn't logged out from Google, ends up in step 2 in the oauth scheme. But that might be a "feature" – Niels Bosma Oct 01 '12 at 19:07
  • 1
    The user can only be recognized by Google if your web browser/view saves cookies. If you rely on the user's default browser, the user can configure this as he likes. If you use an embedded web view, you can probably configure how cookies are handled. – Jan Gerlinger Oct 01 '12 at 19:27

1 Answers1

2

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")
Brian
  • 433
  • 1
  • 7
  • 16
  • You literally call that function and that external Win32 process runs and call windows API's to clear the cookies. It may put up a popup status window, however goes away after cookies are cleared. – Brian Jan 26 '13 at 07:04