AWS Security ChangesHomeSearch

AWS cognito documentation change

Service: cognito · 2025-04-23 · Documentation low

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

Summary

Added Swift SDK code example for ResendConfirmationCode API to demonstrate code resend functionality

Security assessment

The change documents account verification reliability improvements through code resending capabilities. While related to security workflows, there is no indication of patching a specific security flaw.

Diff

diff --git a/cognito/latest/developerguide/cognito-identity-provider_example_cognito-identity-provider_ResendConfirmationCode_section.md b/cognito/latest/developerguide/cognito-identity-provider_example_cognito-identity-provider_ResendConfirmationCode_section.md
index 7067f663b..ec097a5aa 100644
--- a//cognito/latest/developerguide/cognito-identity-provider_example_cognito-identity-provider_ResendConfirmationCode_section.md
+++ b//cognito/latest/developerguide/cognito-identity-provider_example_cognito-identity-provider_ResendConfirmationCode_section.md
@@ -289,0 +290,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_. 
+
+
+
+