1

I implementet Google+ Sign-In API in the root page of my app. It automatically signs in user if user is signed in to google, then API automatically signs him in to my app. The problem is that when user logs out of my app, he is redirected to root page which logs him back in, since he still is logged in to google.

You can see the whole code here: https://developers.google.com/+/web/signin/

wierd, they have "See also, signing the user out of your app." link, but it's broken :(

Any ideas?

Edmund Sulzanok
  • 1,883
  • 3
  • 20
  • 39

1 Answers1

2

This is similar to this question: Preventing automatic sign-in when using Google+ Sign-In

You could use a cookie that is set when the user is logged in on your site. If the user is logged in, indicated by the presence of the cookie, allow the user to automatically get redirected into your site. If the user is not logged in, require that the user click the sign-in button before you hide the button and redirect them to the signed-in experience. To log the user out, delete the cookie.

Community
  • 1
  • 1
class
  • 8,621
  • 29
  • 30
  • I didn't find that question. But anyway, I like your answer better. I agree with opinion: _Second, you probably do not want to have the behavior where the user needs to click to sign in because they are already "signed in" to their Google account and it could be confusing to need to sign in (or trigger sign-in) again, separately, for your site._ I was hoping, that someone might have found official API documentation for that, but if Google doesn't have an API for that - this is a ok workaround. – Edmund Sulzanok Apr 11 '13 at 06:54