Login with google - how to log out?

2019-02-24 04:02发布

I successfully implemented login with google with the example codes provided by google.

However, I'm not sure of how I should use this 'backend-server authentication' thingy.

which is provided in : https://developers.google.com/identity/sign-in/web/backend-auth

I'm developing a website that requires google login and google drive, as the program flows:

  1. User Logins to the website using google account
  2. The User writes some text
  3. The User saves(uploads) to the user's google drive

Before I implement the google drive API, I think I need to handle with the google login system, but I'm not sure how to do it.

Currently, my website goes as 1. User logs in / 2. User logs out / 3. Then the web does not ask the google account, just logs the previous user inside.

Does 'backend-server authentication' gives an answer to my question below?

I understand that it is the same issue as this : How to Logout of an Application Where I Used OAuth2 To Login With Google?. I understood the meaning of the answer, but I cannot find a way to implement to just "log out from the app, not google."

So, to wrap it up, my question will be 2;

  1. How do I use backend-server authentication? (Specifically, the token verifying point)
  2. How do I log out of my web app, not google? and is it related to question 1? (Specifically, if a user logs off from the web app, then another user should be able to log in, by entering their id and password)

2条回答
神经病院院长
2楼-- · 2019-02-24 04:29

From this section of the documentation:

You can enable users to sign out of your app without signing out of Google by adding a sign-out button or link to your site. To create a sign-out link, attach a function that calls the GoogleAuth.signOut() method to the link's onclick event.

查看更多
可以哭但决不认输i
3楼-- · 2019-02-24 04:29
%a{:href => "https://mail.google.com/mail/u/0/?logout&hl=en"} sign-out of google account 

attach this link in your views. this will sign you out of google.

查看更多
登录 后发表回答