我想知道是否有任何方法可以通过API重置登录cookie。 我知道可以通过管理员中的设置来做到这一点。
切换 G Suite 用户的changePasswordAtNextLogin
标志会将其从所有设备中注销。
将changePasswordAtNextLogin
值设置为True
,然后立即False
。这比暂停用户更好,因为传入的邮件不会被退回。
蟒蛇示例:
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("。
没有用于重置登录 cookie 的直接 API。这篇 SO 帖子中有一个解决方法。有关更多信息,您还可以查看此 Google 线程。
根据G Suite论坛的说法,执行此操作的唯一方法是在用户端使用Dito GAM强制重置密码。
来自SE的相关问题:
是否可以在谷歌管理员中为所有Gmail用户重置登录cookie?