title: AWS Cognito: how to delete an identity programmatically?
body: <p>In my Android app, I use AWS Cognito to allow my users to sign up and login. I configured my identity pool so it allows guest users (unauthenticated users) in my app.</p>
  
  <p>So everytime my user logs in or logs out, I call the following code to get an identity ID:</p>
  
  <pre class="lang-java prettyprint-override"><code>CognitoCachingCredentialsProvider credentialsProvider = new CognitoCachingCredentialsProvider(
      this,
      "eu-central-1:12345678-1234-5678-9012-1234567890ab",
      "eu-central-1");
  credentialsProvider.clearCredentials();
  credentialsProvider.getIdentityId();
  </code></pre>
  
  <p>When my user logs in, it creates a new identity the first time, then the user gets the same identity everytime he logs in. But everytime he logs out, a new identity is created, since he's now a "guest" user.</p>
  
  <p>Is that the expected behavior? And if yes, how can I remove an unused identity programmatically (for example when the user logs in, so the "guest" identity is now useless, since a new one will be created when he logs out)?</p>
  
  <p>Thanks for your help.</p>