我正在使用aws-cognito进行身份验证。
在我的应用程序中,用户管理可以删除其他用户的角色。在这种情况下,如果用户已经登录到应用程序/react,他仍然可以访问页面,直到令牌过期。而令牌只有在他退出时才能过期。
我们可以手动终止任何认知用户的会话吗?
发布于 2019-06-07 06:49:34
您只需要UserPoolId和ClientId。当您想注销您的用户时,您可以存储这些值以使用它。管理员是否删除角色并不重要,因为您的参数不依赖于用户的角色。
var poolData = {
UserPoolId: '_', // Userpool id
ClientId: '_' // Client app id you can find in your userpool "General settings" -> "App clients"
};
var userPool = new AWSCognito.CognitoIdentityServiceProvider.CognitoUserPool(poolData);
var cognitoUser = userPool.getCurrentUser();
if (cognitoUser != null) {
cognitoUser.signOut();
}https://stackoverflow.com/questions/56268876
复制相似问题