0

I am unable to logout of gmail in oauth.I tried using -

https://accounts.google.com/Logout?continue=http://google.com

It did work but. Is there any way to logout from gmail without redirect path? I am just a beginner. Can anyone please suggest me an alternative approach. Thank you in advance.

EDIT -

On Sign in -

 function onSignIn(googleUser) {        
      var profile = googleUser.getBasicProfile();
      var username = profile.getEmail(); 
      var profile = googleUser.getBasicProfile();
      var imagurl=profile.getImageUrl();
      var name=profile.getName();
      var email=profile.getEmail();          
      getDetails(email, name);      // call getDetails
    }

 On Sign Out -  

 function signout()
  {     
  document.location.href = "https://www.google.com/accounts/Logout?continue=https://appengine.google.com/_ah/logout?continue=http://google.com";
  }

The above code works but I need an alternative approach for signout without redirect path.

I have tried -

window.location = "https://mail.google.com/mail/u/0/?logout&hl=en";

but it doesnot work.

  • This is unclear - what is the context in which you wish to logout of GMail? – Oliver Charlesworth Dec 06 '17 at 09:50
  • Possible duplicate of [How to Logout of an Application Where I Used OAuth2 To Login With Google?](https://stackoverflow.com/questions/12909332/how-to-logout-of-an-application-where-i-used-oauth2-to-login-with-google) – Wayne Dec 06 '17 at 09:52
  • I want to logout from gmail in my application.The problem is- If the user is logged in gmail.. then without asking for username and password, directly it gets signed in.. in my application. Thatswhy, I need to sign out gmail from my application. – G.S.Tanusha Dec 06 '17 at 10:09
  • I have tried using - **window.location = "https://mail.google.com/mail/u/0/?logout&hl=en" ** but it dint work @Wayne.Can you please suggest on how to use it programmatically? – G.S.Tanusha Dec 06 '17 at 10:11
  • Delete the credentials you have saved for this user. Please include your code we cant help you without seeing how you are doing it. – Linda Lawton - DaImTo Dec 06 '17 at 10:14
  • Added the code snippets. Can you please suggest me how to delete the credentials saved for a particular user? – G.S.Tanusha Dec 06 '17 at 10:22
  • @G.S.Tanusha if you check the accepted answer in the question that I marked this as a dupe of, there are three examples of how to do it. A script, an image, and a window.location reference. In addition, you can use an iframe and/or a new tab/window. You can declare the iframe as hidden via css styling "display:none;" so that the user doesn't see it. in addition your existing approach can work, whereas you simply have it redirect back to your website. Also, this appears to be javascript, not java; there's a considerably large difference between the two. – Wayne Dec 08 '17 at 19:12

0 Answers0