AWS Security ChangesHomeSearch

AWS cognito documentation change

Service: cognito · 2025-06-28 · Documentation low

File: cognito/latest/developerguide/cognito-identity-provider_example_cognito-identity-provider_ListUsers_section.md

Summary

Added Swift code example for ListUsers API operation

Security assessment

The change adds a code example demonstrating ListUsers API usage but contains no security advisories or vulnerability fixes. Error handling for authentication failures is standard API usage documentation.

Diff

diff --git a/cognito/latest/developerguide/cognito-identity-provider_example_cognito-identity-provider_ListUsers_section.md b/cognito/latest/developerguide/cognito-identity-provider_example_cognito-identity-provider_ListUsers_section.md
index bfd4af5a3..3ec5e2025 100644
--- a//cognito/latest/developerguide/cognito-identity-provider_example_cognito-identity-provider_ListUsers_section.md
+++ b//cognito/latest/developerguide/cognito-identity-provider_example_cognito-identity-provider_ListUsers_section.md
@@ -388,0 +389,45 @@ There's more on GitHub. Find the complete example and learn how to set up and ru
+Swift
+    
+
+**SDK for Swift**
+    
+
+###### Note
+
+There's more on GitHub. Find the complete example and learn how to set up and run in the [AWS Code Examples Repository](https://github.com/awsdocs/aws-doc-sdk-examples/tree/main/swift/example_code/cognito-identity-provider#code-examples). 
+    
+    
+            do {
+                let output = try await cognitoClient.listUsers(
+                    input: ListUsersInput(
+                        userPoolId: poolId
+                    )
+                )
+                
+                guard let users = output.users else {
+                    print("No users found.")
+                    return
+                }
+    
+                print("\(users.count) user(s) found.")
+                for user in users {
+                    print("  \(user.username ?? "<unknown>")")
+                }
+            } catch _ as NotAuthorizedException {
+                print("*** Please authenticate with AWS before using this command.")
+                return
+            } catch _ as ResourceNotFoundException {
+                print("*** The specified User Pool was not found.")
+                return
+            } catch {
+                print("*** An unexpected type of error occurred.")
+                return
+            }
+    
+    
+
+  * For API details, see [ListUsers](https://sdk.amazonaws.com/swift/api/awscognitoidentityprovider/latest/documentation/awscognitoidentityprovider/cognitoidentityproviderclient/listusers\(input:\)) in _AWS SDK for Swift API reference_. 
+
+
+
+