如何在注销Gmail后自动从Google App Engine应用程序注销 [英] How to automatically log out from Google App Engine application after logging out of Gmail

查看:140
本文介绍了如何在注销Gmail后自动从Google App Engine应用程序注销的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在PHP中使用App Engine用户服务API。我的应用需要验证。登录身份验证工作正常,但是当我注销我的Gmail帐户时,我的应用程序仍然显示用户已登录。



如何确保应用程序在Gmail帐户登出后还会注销?

 <?php 
使用google\ appengine\api\users\User;
使用google\appengine\api\users\UserService;
$ user = UserService :: getCurrentUser();

if($ user)
{
#perform action
}
else
{
header('Location:' 。UserService :: createLoginURL($ _ SERVER ['REQUEST_URI']));


解决方案

这是不可能的。 / p>

当您在App Engine上使用用户服务API时,它会根据您的Google帐户验证您的身份,并在您的App Engine服务器上创建会话。这一切都由API无缝处理。认证之后,您将被独立认证到您的App Engine服务器。因此,注销您的Google帐户不会影响您的App Engine会话。



然而,这可以反过来工作(即注销您的App Engine将记录您从您的Google帐户中删除),因为该操作是从您的App Engine帐户触发的。


I'm using the App Engine Users Service API in PHP. My app requires authentication. The authentication for logging in is working fine, but when I logout of my Gmail account my app still shows that the user is logged in.

How do I make sure that the app also gets logged out the moment the Gmail account is logged out?

<?php
use google\appengine\api\users\User;
use google\appengine\api\users\UserService;
$user = UserService::getCurrentUser();

if ($user) 
{
    #perform action
}
else 
{
    header('Location: ' . UserService::createLoginURL($_SERVER['REQUEST_URI']));
}

解决方案

This is not possible.

When you use the Users Service API on App Engine, it authenticates you against your Google Account, and creates a 'session' on your App Engine server. This is all handled seamlessly by the API. After authentication, you are authenticated to your App Engine server independently. Therefore, logging out of your Google Account does not effect your App Engine session.

This does work the other way around however (ie logging out of your App Engine WILL log you out of your Google Account), as the action is triggered from your App Engine account.

这篇关于如何在注销Gmail后自动从Google App Engine应用程序注销的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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