用谷歌登录 - 如何注销? [英] Login with google - how to log out?

查看:230
本文介绍了用谷歌登录 - 如何注销?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我成功地使用谷歌提供的示例代码实现了登录。



然而,我不确定我应该如何使用这个'后端服务器身份验证'thingy。



它提供于: https://developers.google.com/identity/sign-in/web/backend-auth



我是开发一个网站,需要谷歌登录和谷歌驱动器,随着程序流动:


  1. 用户使用Google帐户登录网站

  2. 用户写入一些文本

  3. 用户保存(上传)到用户的谷歌驱动器

在我实现谷歌驱动器API之前,我认为我需要使用谷歌登录系统来处理,但我不知道如何去做。



目前,我的网站为
1.用户登录/ 2.用户注销/ 3.然后网站不会询问Google acc ount,只是记录之前的用户。



'后端服务器身份验证'是否为我的问题提供了答案?



我知道它是与此相同的问题:如何注销我在哪里使用OAuth2使用Google登录?
我理解了答案的含义,但我找不到一种方法来实现从应用程序注销,而不是谷歌。

因此,将其包装起来,我的问题将是2;


  1. 如何使用后端服务器身份验证? (具体来说,代币验证点)
  2. 如何退出我的网络应用程序,而不是谷歌?这与问题1有关吗? (具体来说,如果用户从Web应用程序注销,则另一个用户应该能够通过输入他们的ID和密码登录)


解决方案

此文档部分


您可以让用户退出您的应用,而无需退出
Google通过添加注销按钮或链接到您的网站。要创建
注销链接,请附加一个调用
GoogleAuth.signOut()方法到链接的 onclick 事件。



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)

解决方案

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.

这篇关于用谷歌登录 - 如何注销?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆