{"action":"opened","issue":{"url":"https://api.github.com/repos/awslabs/aws-sdk-ios-samples/issues/306","repository_url":"https://api.github.com/repos/awslabs/aws-sdk-ios-samples","labels_url":"https://api.github.com/repos/awslabs/aws-sdk-ios-samples/issues/306/labels{/name}","comments_url":"https://api.github.com/repos/awslabs/aws-sdk-ios-samples/issues/306/comments","events_url":"https://api.github.com/repos/awslabs/aws-sdk-ios-samples/issues/306/events","html_url":"https://github.com/awslabs/aws-sdk-ios-samples/issues/306","id":366218300,"node_id":"MDU6SXNzdWUzNjYyMTgzMDA=","number":306,"title":"Users still going to unauth identity in ID pool","user":{"login":"Linger-ing","id":26104181,"node_id":"MDQ6VXNlcjI2MTA0MTgx","avatar_url":"https://avatars1.githubusercontent.com/u/26104181?v=4","gravatar_id":"","url":"https://api.github.com/users/Linger-ing","html_url":"https://github.com/Linger-ing","followers_url":"https://api.github.com/users/Linger-ing/followers","following_url":"https://api.github.com/users/Linger-ing/following{/other_user}","gists_url":"https://api.github.com/users/Linger-ing/gists{/gist_id}","starred_url":"https://api.github.com/users/Linger-ing/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Linger-ing/subscriptions","organizations_url":"https://api.github.com/users/Linger-ing/orgs","repos_url":"https://api.github.com/users/Linger-ing/repos","events_url":"https://api.github.com/users/Linger-ing/events{/privacy}","received_events_url":"https://api.github.com/users/Linger-ing/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2018-10-03T08:03:01Z","updated_at":"2018-10-03T08:03:01Z","closed_at":null,"author_association":"NONE","body":"I have followed all the steps as given in the AWS doc and also tried methods shows here. But still, my user is going to unauthenticated access in the ID pool. I have my code here. Can anyone please tell me where I am going wrong. \r\n\r\n```\r\nfunc login(){\r\n        \r\n        \r\n        self.fetchUserAttributes()\r\n        \r\n       \r\n        //cognito\r\n        \r\n        \r\n        let credentialsProvider = AWSCognitoCredentialsProvider(regionType: .USWest2, identityPoolId: \"us-west-2:555da9bf-410a-41da-8a39-XXXXXXXX\", identityProviderManager: pool)\r\n        let serviceConfiguration = AWSServiceConfiguration(region: .USWest2, credentialsProvider: credentialsProvider)!\r\n        AWSServiceManager.default().defaultServiceConfiguration = AWSServiceConfiguration(region: .USWest2, credentialsProvider: credentialsProvider)\r\n    \r\n       credentialsProvider.getIdentityId().continueWith { (task) -> Any? in\r\n            \r\n          //  print(credentialsProvider.credentials())\r\n            \r\n            \r\n            let client = APPTIMEUserAppTimeClient.default()\r\n            \r\n            \r\n            let testbody = APPTIMEPostRequestModel()\r\n            testbody?.userId=\"2\"\r\n            testbody!.appTime=100\r\n            \r\n            \r\n            client.apptimePost(body: testbody! ).continueWith{ (task: AWSTask?) -> AnyObject? in\r\n                if let error = task!.error {\r\n                    print(\"Error occurred: \\(error)\")\r\n                    return nil\r\n                }\r\n                \r\n                if let result = task!.result {\r\n                    // Do something with result\r\n                    print(result)\r\n                }\r\n                \r\n                return nil\r\n            }\r\n        return nil\r\n        }\r\n            \r\n        self.user?.signOut()\r\n        \r\n        alertCustom(\"Go to setup profile page\", self)\r\n    }\r\n```\r\nI am calling the above code after sign in. I need to make the API call. but it is showing not authorised exception. here is the error in the console \r\n\r\n> > Request headers:\r\n> {\r\n>     \"Content-Type\" = \"application/x-amz-json-1.1\";\r\n>     Host = \"cognito-identity.us-west-2.amazonaws.com\";\r\n>     \"User-Agent\" = \"aws-sdk-iOS/2.6.13 iOS/12.0 en_US\";\r\n>     \"X-Amz-Date\" = 20181003T075610Z;\r\n>     \"X-Amz-Target\" = \"AWSCognitoIdentityService.GetId\";\r\n> }\r\n> \r\n> 2018-10-03 13:26:10:731 loopstalk[7306:81118] Request body:\r\n> {\"IdentityPoolId\":\"us-west-2:555da9bf-410a-41da-8a39-be6d86315097\"}\r\n> 2018-10-03 13:26:10.740715+0530 loopstalk[7306:81337] [BoringSSL] nw_protocol_boringssl_get_output_frames(1301) [C3.1:2][0x7f9b61cd0210] get output frames failed, state 8196\r\n> 2018-10-03 13:26:10.742152+0530 loopstalk[7306:81337] [BoringSSL] nw_protocol_boringssl_get_output_frames(1301) [C3.1:2][0x7f9b61cd0210] get output frames failed, state 8196\r\n> 2018-10-03 13:26:10.742979+0530 loopstalk[7306:81337] TIC Read Status [3:0x0]: 1:57\r\n> 2018-10-03 13:26:10.743119+0530 loopstalk[7306:81337] TIC Read Status [3:0x0]: 1:57\r\n> 2018-10-03 13:26:11:041 loopstalk[7306:81116] Response headers:\r\n> {\r\n>     \"Content-Length\" = 111;\r\n>     \"Content-Type\" = \"application/x-amz-json-1.1\";\r\n>     Date = \"Wed, 03 Oct 2018 07:56:10 GMT\";\r\n>     \"x-amzn-errormessage\" = \"Unauthenticated access is not supported for this identity pool.\";\r\n>     \"x-amzn-errortype\" = \"NotAuthorizedException:\";\r\n>     \"x-amzn-requestid\" = \"caeb9d51-c6e1-11e8-baa6-fd6e9c8f3891\";\r\n> }\r\n> 2018-10-03 13:26:11:041 loopstalk[7306:81116] Response body:\r\n> {\"__type\":\"NotAuthorizedException\",\"message\":\"Unauthenticated access is not supported for this identity pool.\"}\r\n> 2018-10-03 13:26:11:041 loopstalk[7306:81116] GetId failed. Error is [Error Domain=com.amazonaws.AWSCognitoIdentityErrorDomain Code=8 \"(null)\" UserInfo={__type=NotAuthorizedException, message=Unauthenticated access is not supported for this identity pool.}]\r\n> 2018-10-03 13:26:11:042 loopstalk[7306:81360] Unable to refresh. Error is [Error Domain=com.amazonaws.AWSCognitoIdentityErrorDomain Code=8 \"(null)\" UserInfo={__type=NotAuthorizedException, message=Unauthenticated access is not supported for this identity pool.}]\r\n> \r\n> > \r\n> \r\n\r\nhere is the Cognito code in appDelegate \r\n```\r\n` func setupCognitoUserPool() {\r\n        let clientId:String = \"53mqhcXXXXXXXXXXq3b3v1\"\r\n        let poolId:String = \"us-west-2_22yXXXXXZg85\"\r\n        let clientSecret:String = \"1aqr772ddXXXXXXXXXXXXXXu5ochdfsjc2ergnrna48\"\r\n      //  let region: AWSRegionType = AWSRegionType.USWest2\r\n        \r\n        \r\n        \r\n        \r\n        let serviceConfiguration = AWSServiceConfiguration(region: .USWest2, credentialsProvider: nil)\r\n        let userPoolConfiguration = AWSCognitoIdentityUserPoolConfiguration(clientId: clientId, clientSecret: clientSecret, poolId: poolId)\r\n        AWSCognitoIdentityUserPool.register(with: serviceConfiguration, userPoolConfiguration: userPoolConfiguration, forKey: \"UserPool\")\r\n        let pool = AWSCognitoIdentityUserPool(forKey: \"UserPool\")\r\n         pool.delegate = self`}\r\n```"}}
{"actor":{"display_login":"Linger-ing"}}