AWS Security ChangesHomeSearch

AWS code-library documentation change

Service: code-library · 2025-04-23 · Documentation low

File: code-library/latest/ug/cognito-identity-provider_example_cognito-identity-provider_ResendConfirmationCode_section.md

Summary

Added Swift SDK code example for ResendConfirmationCode API implementation

Security assessment

The change demonstrates how to resend confirmation codes but doesn't indicate any security fixes or new security features. This is a standard documentation update for authentication workflow implementation.

Diff

diff --git a/code-library/latest/ug/cognito-identity-provider_example_cognito-identity-provider_ResendConfirmationCode_section.md b/code-library/latest/ug/cognito-identity-provider_example_cognito-identity-provider_ResendConfirmationCode_section.md
index fb9377b75..1a5675e45 100644
--- a//code-library/latest/ug/cognito-identity-provider_example_cognito-identity-provider_ResendConfirmationCode_section.md
+++ b//code-library/latest/ug/cognito-identity-provider_example_cognito-identity-provider_ResendConfirmationCode_section.md
@@ -291,0 +292,53 @@ 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). 
+    
+    
+    import AWSCognitoIdentityProvider
+    
+        /// Requests a new confirmation code be sent to the given user's contact
+        /// method.
+        ///
+        /// - Parameters:
+        ///   - cipClient: The `CognitoIdentityProviderClient` to use.
+        ///   - clientId: The application client ID.
+        ///   - userName: The user to resend a code for.
+        ///
+        /// - Returns: `true` if a new code was sent successfully, otherwise
+        ///   `false`.
+        func resendConfirmationCode(cipClient: CognitoIdentityProviderClient, clientId: String,
+                                    userName: String) async -> Bool {
+            do {
+                let output = try await cipClient.resendConfirmationCode(
+                    input: ResendConfirmationCodeInput(
+                        clientId: clientId,
+                        username: userName
+                    )
+                )
+    
+                guard let deliveryMedium = output.codeDeliveryDetails?.deliveryMedium else {
+                    print("*** Unable to get the delivery method for the resent code.")
+                    return false
+                }
+    
+                print("=====> A new code has been sent by \(deliveryMedium)")
+                return true
+            } catch {
+                print("*** Unable to resend the confirmation code to user \(userName).")
+                return false
+            }
+        }
+    
+    
+
+  * For API details, see [ResendConfirmationCode](https://sdk.amazonaws.com/swift/api/awscognitoidentityprovider/latest/documentation/awscognitoidentityprovider/cognitoidentityproviderclient/resendconfirmationcode\(input:\)) in _AWS SDK for Swift API reference_. 
+
+
+
+