-
-
Save mgwedd/4519539f978c66d1b7c4e9851f7aad75 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
func getAWSClientID(completion: @escaping (_ clientId: String?,_ error: Error? ) -> Void) { | |
// Depending on your scope you may still have access to the original credentials var | |
let credentials = AWSCognitoCredentialsProvider(regionType:.EUWest1, identityPoolId: "your-identity-pool-id") | |
credentials.getIdentityId().continueWith(block: { (task:AWSTask<NSString>) -> Any? in | |
if let error = task.error as NSError? { | |
print("Failed to get client ID => \(error)") | |
completion(nil, error) | |
return nil // Required by AWSTask closure | |
} | |
let clientId = task.result! as String | |
print("Got client ID => \(clientId)") | |
completion(clientId, nil) | |
return nil // Required by AWSTask closure | |
}) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment