Works without an issue when calling
AWSMobileClient.getInstance().getTokens().getIdToken().getClaim("sub");
Right after I login.
AWSMobileClient.getInstance().signIn(username, password....
However when I resume activity(go to another app) and come back and try getting tokens again I get the error:
D/AWSMobileClient: waitForSignIn: userState:SIGNED_IN
D/AWSMobileClient: Inspecting user state details
D/AWSMobileClient: hasFederatedToken: false provider: cognito-idp.us-east-1.amazonaws.com/us-east-1_.....
D/AWSMobileClient: hasFederatedToken: false provider: cognito-idp.us-east-1.amazonaws.com/us-east-1_
D/CognitoCachingCredentialsProvider: Clearing credentials from SharedPreferences
D/CognitoCachingCredentialsProvider: Clearing credentials from SharedPreferences
W/AWSMobileClient: Failed to federate the tokens
android.os.NetworkOnMainThreadException
at android.os.StrictMode$AndroidBlockGuardPolicy.onNetwork(StrictMode.java:1450)
at java.net.Inet6AddressImpl.lookupHostByName(Inet6AddressImpl.java:102)
at java.net.Inet6AddressImpl.lookupAllHostAddr(Inet6AddressImpl.java:90)
at java.net.InetAddress.getAllByName(InetAddress.java:787)
at com.android.okhttp.Dns$1.lookup(Dns.java:39)
Not sure why. Heres my current awsconfiguration:
{
"IdentityManager": {
"Default": {}
},
"CredentialsProvider": {
"CognitoIdentity": {
"Default": {
"PoolId": "us-east-1:088e7bc3...",
"Region": "us-east-1"
}
}
},
"CognitoUserPool": {
"Default": {
"PoolId": "us-east-1_....",
"AppClientId": "50e3s5e....",
"AppClientSecret": "1mbug...",
"Region": "us-east-1"
}
}
}