如何从amazon cognito javascript注销并清除缓存的identityId

kab*_*ius 12 amazon-web-services amazon-cognito

到目前为止,我已设法登录到cognito并同步数据,但我仍然坚持签署用户.能够从身份提供商退出,但再次登录到cognito时,我收到无效登录错误.当我重新加载应用程序虽然它工作.

JBa*_*zuk 10

已经为此创建了一个问题.当前的解决方法是清除Cognito Credentials对象中的缓存ID,然后重新初始化它:

cognitoCredentials.clearCachedId();
cognitoCredentials = new AWS.CognitoIdentityCredentials(cognitoParams);
AWS.config.credentials = cognitoCredentials;
Run Code Online (Sandbox Code Playgroud)

其中cognitoParams是用于初始化凭证的对象,例如:

cognitoParams = {
  IdentityPoolId: 'us-east-1:ebee2fff-acde-4382-a090-5990604a007d'
};
Run Code Online (Sandbox Code Playgroud)