通过API重置登录Cookie [英] Reset the login cookie by API
本文介绍了通过API重置登录Cookie的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想知道是否有任何方法可以通过API重置登录Cookie. 我知道如何通过admin中的设置来做到这一点.
I wonder if there is any way to reset login cookies through the API. I know there is how to do this through the settings in admin.
推荐答案
切换G Suite用户的changePasswordAtNextLogin
标志会使他退出所有设备.
Toggling changePasswordAtNextLogin
flag of a G Suite user logs him out of all devices.
将changePasswordAtNextLogin
的值设置为True
,然后立即将其设置为False
.比暂停用户更好,因为传入的邮件不会被退回.
Make the changePasswordAtNextLogin
value to True
and then False
immediately. It is better than suspending the user as incoming mails will not get bounced.
Python示例:
def changePasswordNextLogin(self,userEmail, status=True):
try:
reqBody = {"changePasswordAtNextLogin":status}
updateStatus = self.service.users().update(userKey=userEmail,body=reqBody).execute()
return True
except Exception, e:
logging.info("Exception change_passwordNextLogin = %s", e)
return False
def forceLogoutUser(self, userEmail):
self.changePasswordNextLogin(userEmail, True)
self.changePasswordNextLogin(userEmail, False)
return True
要将用户从所有设备中注销时,请调用"forceLogoutUser(userEmail)".
Call 'forceLogoutUser(userEmail)' when you want to log a user out of a all devices.
这篇关于通过API重置登录Cookie的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文