{"action":"created","issue":{"url":"https://api.github.com/repos/awslabs/aws-sdk-ios-samples/issues/290","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/290/labels{/name}","comments_url":"https://api.github.com/repos/awslabs/aws-sdk-ios-samples/issues/290/comments","events_url":"https://api.github.com/repos/awslabs/aws-sdk-ios-samples/issues/290/events","html_url":"https://github.com/awslabs/aws-sdk-ios-samples/issues/290","id":352512008,"node_id":"MDU6SXNzdWUzNTI1MTIwMDg=","number":290,"title":"Cannot get token just after pool login ","user":{"login":"evgzor","id":5227456,"node_id":"MDQ6VXNlcjUyMjc0NTY=","avatar_url":"https://avatars3.githubusercontent.com/u/5227456?v=4","gravatar_id":"","url":"https://api.github.com/users/evgzor","html_url":"https://github.com/evgzor","followers_url":"https://api.github.com/users/evgzor/followers","following_url":"https://api.github.com/users/evgzor/following{/other_user}","gists_url":"https://api.github.com/users/evgzor/gists{/gist_id}","starred_url":"https://api.github.com/users/evgzor/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/evgzor/subscriptions","organizations_url":"https://api.github.com/users/evgzor/orgs","repos_url":"https://api.github.com/users/evgzor/repos","events_url":"https://api.github.com/users/evgzor/events{/privacy}","received_events_url":"https://api.github.com/users/evgzor/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2018-08-21T12:15:26Z","updated_at":"2018-08-27T20:12:56Z","closed_at":null,"author_association":"NONE","body":"Using Installing AWSCognitoIdentityProvider 2.6.27 \r\nUsing AWSCognitoIdentityProviderASF (1.0.1)\r\nInstalling AWSCore 2.6.27\r\n\r\nTrying to get token after login like:\r\n\r\n```swift\r\n    public func didCompleteStepWithError(_ error: Error?) {\r\n        \r\n            if let error = error as NSError? {\r\n               \r\n            } else {\r\n        \r\n                    let pool = AWSCognitoIdentityUserPool(forKey: AWSCognitoUserPoolsSignInProviderKey)\r\n                    var token: AWSCognitoIdentityUserSessionToken?\r\n                \r\n                    pool.currentUser()?.getSession().continueWith(block: { (task) -> Void in\r\n                        guard let result = task.result else {\r\n                            return\r\n                        }\r\n                        if((result.idToken) != nil){\r\n                            token = result.idToken\r\n                        } else if(result.accessToken != nil){\r\n                            token = result.accessToken\r\n                        }\r\n                        print(token?.tokenString)\r\n                        self.username.text = nil\r\n                        self.dismiss(animated: true, completion: nil)\r\n                        \r\n                    })\r\n            }\r\n    }\r\n}\r\n```\r\n\r\nWithout delay, it does not work. Could u please point me why? If using delay its works but without no callback response."},"comment":{"url":"https://api.github.com/repos/awslabs/aws-sdk-ios-samples/issues/comments/416353034","html_url":"https://github.com/awslabs/aws-sdk-ios-samples/issues/290#issuecomment-416353034","issue_url":"https://api.github.com/repos/awslabs/aws-sdk-ios-samples/issues/290","id":416353034,"node_id":"MDEyOklzc3VlQ29tbWVudDQxNjM1MzAzNA==","user":{"login":"kvasukib","id":15204269,"node_id":"MDQ6VXNlcjE1MjA0MjY5","avatar_url":"https://avatars3.githubusercontent.com/u/15204269?v=4","gravatar_id":"","url":"https://api.github.com/users/kvasukib","html_url":"https://github.com/kvasukib","followers_url":"https://api.github.com/users/kvasukib/followers","following_url":"https://api.github.com/users/kvasukib/following{/other_user}","gists_url":"https://api.github.com/users/kvasukib/gists{/gist_id}","starred_url":"https://api.github.com/users/kvasukib/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kvasukib/subscriptions","organizations_url":"https://api.github.com/users/kvasukib/orgs","repos_url":"https://api.github.com/users/kvasukib/repos","events_url":"https://api.github.com/users/kvasukib/events{/privacy}","received_events_url":"https://api.github.com/users/kvasukib/received_events","type":"User","site_admin":false},"created_at":"2018-08-27T20:12:56Z","updated_at":"2018-08-27T20:12:56Z","author_association":"CONTRIBUTOR","body":"@evgzor Thank you for reporting to us. Can you add a call to `waitUnitFinished()`?\r\n\r\n```swift\r\npool.currentUser()?.getSession().continueWith(block: { (task) -> Void in\r\n                        guard let result = task.result else {\r\n                            return\r\n                        }\r\n                        if((result.idToken) != nil){\r\n                            token = result.idToken\r\n                        } else if(result.accessToken != nil){\r\n                            token = result.accessToken\r\n                        }\r\n                        print(token?.tokenString)\r\n                        self.username.text = nil\r\n                        self.dismiss(animated: true, completion: nil) \r\n                    }).waitUntilFinished()\r\n```"}}
{"actor":{"display_login":"kvasukib"}}