title: Sign-out status user AWSCognito in clean installation of android application
body: <p>I have the following case. the AWSCognito sdk returns an error that arises when the application is installed for the first time, the cognito sdk returns SIGN-OUT in the initialization method, when the SIGN-OUT status is obtained, it is logged in with username and password, using SIGN-IN method, this method returns a DONE status. When trying to obtain the token, the user's status is still at the end of the session, despite the fact that in the SIGN-IN (SIGN-IN) function, the DONE status (DONE) responded and could not obtain the token</p>
  
  <p>build.gradle (app)</p>
  
  <pre><code>implementation 'com.amazonaws:aws-android-sdk-mobile-client:2.13.4'
  implementation 'com.amazonaws:aws-android-sdk-auth-userpools:2.13.4'
  </code></pre>
  
  <p>MainActivity</p>
  
  <pre><code>class MainActivity : AppCompatActivity() {
  
     override fun onCreate(savedInstanceState: Bundle?) {
         super.onCreate(savedInstanceState)
         setContentView(R.layout.activity_main)
         AWSMobileClient.getInstance().initialize(applicationContext, object : Callback&lt;UserStateDetails&gt;{
             override fun onResult(result: UserStateDetails?) {
                 Log.i("awscognito", result?.userState?.name)
                 when (result?.userState) {
                     UserState.SIGNED_OUT -&gt; {
                         Log.i("awscognito", "no hay sesion")
                         login()
                     }
                     UserState.SIGNED_IN -&gt; Log.d("COGNITO_STATE", "hay sesion")
                     else -&gt; Log.i("awscognito", "entra al else")
                 }
             }
  
             override fun onError(e: Exception?) {
                 Log.d("awscognito", e.toString())
             }
         })
     }
  
     fun login(){
         val username = "user"
         val password = "password"
  
         val signInResult = AWSMobileClient.getInstance().signIn(username, password, null)
         when (signInResult.signInState) {
             SignInState.NEW_PASSWORD_REQUIRED -&gt; Log.i("awscognito", signInResult.signInState.name)
             SignInState.SMS_MFA -&gt; Log.i("awscognito", signInResult.signInState.name)
             SignInState.ADMIN_NO_SRP_AUTH-&gt; Log.i("awscognito", signInResult.signInState.name)
             SignInState.CUSTOM_CHALLENGE -&gt; Log.i("awscognito", signInResult.signInState.name)
             SignInState.DEVICE_PASSWORD_VERIFIER -&gt; Log.i("awscognito", signInResult.signInState.name)
             SignInState.DEVICE_SRP_AUTH -&gt; Log.i("awscognito", signInResult.signInState.name)
             SignInState.PASSWORD_VERIFIER -&gt; Log.i("awscognito", signInResult.signInState.name)
             SignInState.UNKNOWN -&gt; Log.i("COGNITO_STATE", signInResult.signInState.name)
             SignInState.DONE -&gt; {
                 Log.i("awscognito", signInResult.signInState.name)
                 getToken()
             }
         }
  
     }
  
     fun getToken(){
         AWSMobileClient.getInstance().getTokens(object : Callback&lt;Tokens&gt;{
             override fun onResult(result: Tokens?) {
                 Log.i("awscognito", result?.idToken?.tokenString)
             }
  
             override fun onError(e: java.lang.Exception?) {
                 Log.i("awscognito", e.toString())
             }
         })
     }
  }
  </code></pre>
  
  <p>I hope Awscognito will return a valid token, but I get the following result</p>
  
  <pre><code>2019-05-14 08:25:56.763 5666-5687/com.example.cognito W/AWSMobileClient: Failed to federate tokens during sign-in
      java.lang.RuntimeException: Error in federating the token.
          at com.amazonaws.mobile.client.AWSMobileClient$8.run(AWSMobileClient.java:1484)
          at com.amazonaws.mobile.client.internal.InternalCallback.await(InternalCallback.java:115)
          at com.amazonaws.mobile.client.AWSMobileClient.federatedSignInWithoutAssigningState(AWSMobileClient.java:1414)
          at com.amazonaws.mobile.client.AWSMobileClient$6$1.onSuccess(AWSMobileClient.java:1156)
          at com.amazonaws.mobileconnectors.cognitoidentityprovider.CognitoUser$6.onSuccess(CognitoUser.java:787)
          at com.amazonaws.mobileconnectors.cognitoidentityprovider.CognitoUser$27.run(CognitoUser.java:2553)
          at com.amazonaws.mobileconnectors.cognitoidentityprovider.CognitoUser$24.run(CognitoUser.java:2430)
          at com.amazonaws.mobileconnectors.cognitoidentityprovider.continuations.AuthenticationContinuation.continueTask(AuthenticationContinuation.java:124)
          at com.amazonaws.mobile.client.AWSMobileClient$6$1.getAuthenticationDetails(AWSMobileClient.java:1173)
          at com.amazonaws.mobileconnectors.cognitoidentityprovider.CognitoUser.getSession(CognitoUser.java:751)
          at com.amazonaws.mobile.client.AWSMobileClient$6.run(AWSMobileClient.java:1142)
          at com.amazonaws.mobile.client.internal.InternalCallback.await(InternalCallback.java:115)
          at com.amazonaws.mobile.client.AWSMobileClient.signIn(AWSMobileClient.java:1127)
          at com.example.cognito.MainActivity.login(MainActivity.kt:43)
          at com.example.cognito.MainActivity$onCreate$1.onResult(MainActivity.kt:26)
          at com.example.cognito.MainActivity$onCreate$1.onResult(MainActivity.kt:20)
          at com.amazonaws.mobile.client.internal.InternalCallback.call(InternalCallback.java:75)
          at com.amazonaws.mobile.client.internal.InternalCallback.onResult(InternalCallback.java:62)
          at com.amazonaws.mobile.client.AWSMobileClient$2.run(AWSMobileClient.java:593)
          at com.amazonaws.mobile.client.internal.InternalCallback$1.run(InternalCallback.java:101)
          at java.lang.Thread.run(Thread.java:764)
       Caused by: com.amazonaws.services.cognitoidentity.model.InvalidIdentityPoolConfigurationException: Invalid identity pool configuration. Check assigned IAM roles for this pool. (Service: AmazonCognitoIdentity; Status Code: 400; Error Code: InvalidIdentityPoolConfigurationException; Request ID: 3085dbf4-7654-11e9-99fb-516bf8dbaba2)
          at com.amazonaws.http.AmazonHttpClient.handleErrorResponse(AmazonHttpClient.java:730)
          at com.amazonaws.http.AmazonHttpClient.executeHelper(AmazonHttpClient.java:405)
          at com.amazonaws.http.AmazonHttpClient.execute(AmazonHttpClient.java:212)
          at com.amazonaws.services.cognitoidentity.AmazonCognitoIdentityClient.invoke(AmazonCognitoIdentityClient.java:1658)
          at com.amazonaws.services.cognitoidentity.AmazonCognitoIdentityClient.getCredentialsForIdentity(AmazonCognitoIdentityClient.java:680)
          at com.amazonaws.auth.CognitoCredentialsProvider.populateCredentialsWithCognito(CognitoCredentialsProvider.java:782)
          at com.amazonaws.auth.CognitoCredentialsProvider.startSession(CognitoCredentialsProvider.java:694)
          at com.amazonaws.auth.CognitoCredentialsProvider.refresh(CognitoCredentialsProvider.java:631)
          at com.amazonaws.auth.CognitoCachingCredentialsProvider.refresh(CognitoCachingCredentialsProvider.java:510)
          at com.amazonaws.auth.CognitoCachingCredentialsProvider.getIdentityId(CognitoCachingCredentialsProvider.java:452)
          at com.amazonaws.auth.CognitoCredentialsProvider.populateCredentialsWithCognito(CognitoCredentialsProvider.java:776)
          at com.amazonaws.auth.CognitoCredentialsProvider.startSession(CognitoCredentialsProvider.java:694)
          at com.amazonaws.auth.CognitoCredentialsProvider.refresh(CognitoCredentialsProvider.java:631)
          at com.amazonaws.auth.CognitoCachingCredentialsProvider.refresh(CognitoCachingCredentialsProvider.java:510)
          at com.amazonaws.mobile.client.AWSMobileClient.federateWithCognitoIdentity(AWSMobileClient.java:1515)
          at com.amazonaws.mobile.client.AWSMobileClient$8.run(AWSMobileClient.java:1471)
          at com.amazonaws.mobile.client.internal.InternalCallback.await(InternalCallback.java:115) 
          at com.amazonaws.mobile.client.AWSMobileClient.federatedSignInWithoutAssigningState(AWSMobileClient.java:1414) 
          at com.amazonaws.mobile.client.AWSMobileClient$6$1.onSuccess(AWSMobileClient.java:1156) 
          at com.amazonaws.mobileconnectors.cognitoidentityprovider.CognitoUser$6.onSuccess(CognitoUser.java:787) 
          at com.amazonaws.mobileconnectors.cognitoidentityprovider.CognitoUser$27.run(CognitoUser.java:2553) 
          at com.amazonaws.mobileconnectors.cognitoidentityprovider.CognitoUser$24.run(CognitoUser.java:2430) 
          at com.amazonaws.mobileconnectors.cognitoidentityprovider.continuations.AuthenticationContinuation.continueTask(AuthenticationContinuation.java:124) 
          at com.amazonaws.mobile.client.AWSMobileClient$6$1.getAuthenticationDetails(AWSMobileClient.java:1173) 
          at com.amazonaws.mobileconnectors.cognitoidentityprovider.CognitoUser.getSession(CognitoUser.java:751) 
          at com.amazonaws.mobile.client.AWSMobileClient$6.run(AWSMobileClient.java:1142) 
          at com.amazonaws.mobile.client.internal.InternalCallback.await(InternalCallback.java:115) 
          at com.amazonaws.mobile.client.AWSMobileClient.signIn(AWSMobileClient.java:1127) 
          at com.example.cognito.MainActivity.login(MainActivity.kt:43) 
          at com.example.cognito.MainActivity$onCreate$1.onResult(MainActivity.kt:26) 
          at com.example.cognito.MainActivity$onCreate$1.onResult(MainActivity.kt:20) 
          at com.amazonaws.mobile.client.internal.InternalCallback.call(InternalCallback.java:75) 
          at com.amazonaws.mobile.client.internal.InternalCallback.onResult(InternalCallback.java:62) 
          at com.amazonaws.mobile.client.AWSMobileClient$2.run(AWSMobileClient.java:593) 
          at com.amazonaws.mobile.client.internal.InternalCallback$1.run(InternalCallback.java:101) 
          at java.lang.Thread.run(Thread.java:764) 
  2019-05-14 08:25:56.764 5666-5687/com.example.cognito I/awscognito: DONE
  2019-05-14 08:25:56.766 5666-5709/com.example.cognito D/AWSMobileClient: Inspecting user state details
  2019-05-14 08:25:56.767 5666-5709/com.example.cognito D/AWSMobileClient: waitForSignIn: userState:SIGNED_OUT
  2019-05-14 08:25:56.767 5666-5709/com.example.cognito I/awscognito: java.lang.Exception: getTokens does not support retrieving tokens while signed-out
  </code></pre>