Home » Android » Issue AWS mobile hub sign-in – NotAuthorizedException for identity pool

Issue AWS mobile hub sign-in – NotAuthorizedException for identity pool

Posted by: admin November 1, 2017 Leave a comment

Questions:

I am referring to AWS Mobile Hub Developer Guide (for integrating email-based user sign-in) http://docs.aws.amazon.com/mobile-hub/latest/developerguide/amhd-dg.pdf

Topic titled : Setup your app for AWS Mobile services (Android – Java)

Last step no 8 outcome should be “IdentityManager: Got user ID: us-east-1:abcabcabc-0be6-444e-b101-abcabcabc”
but I am getting “D/IdentityManager: Got user ID: null”

Stack trace for exception:

E/IdentityManager: Unauthenticated access is not supported for this identity pool. (Service: AmazonCognitoIdentity; Status Code: 400; Error Code: NotAuthorizedException; Request ID: d275fc19-b700-11e7-bac5-5d9ca7c93439)
                                                                                   com.amazonaws.services.cognitoidentity.model.NotAuthorizedException: Unauthenticated access is not supported for this identity pool. (Service: AmazonCognitoIdentity; Status Code: 400; Error Code: NotAuthorizedException; Request ID: d275fc19-b700-11e7-bac5-5d9ca7c93439)
                                                                                       at com.amazonaws.http.AmazonHttpClient.handleErrorResponse(AmazonHttpClient.java:729)
                                                                                       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:559)
                                                                                       at com.amazonaws.services.cognitoidentity.AmazonCognitoIdentityClient.getId(AmazonCognitoIdentityClient.java:445)
                                                                                       at com.amazonaws.auth.AWSAbstractCognitoIdentityProvider.getIdentityId(AWSAbstractCognitoIdentityProvider.java:172)
                                                                                       at com.amazonaws.auth.CognitoCredentialsProvider.getIdentityId(CognitoCredentialsProvider.java:402)
                                                                                       at com.amazonaws.auth.CognitoCachingCredentialsProvider.getIdentityId(CognitoCachingCredentialsProvider.java:465)
                                                                                       at com.amazonaws.mobile.auth.core.IdentityManager$1.run(IdentityManager.java:334)
                                                                                       at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:422)
                                                                                       at java.util.concurrent.FutureTask.run(FutureTask.java:237)
                                                                                       at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112)
                                                                                       at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587)
                                                                                       at java.lang.Thread.run(Thread.java:841)


------------------------

D/IdentityManager: Got user ID: null
Answers: