For advanced use cases where Amplify does not provide the functionality you're looking for,
you can retrieve the escape hatch to access the underlying SDK.

import android0 from "/src/fragments/lib/android-escape-hatch-warning.mdx";

<Fragments fragments={{android: android0}} />

The escape hatch provides access to the underlying `CognitoIdentityProviderClient` and `CognitoIdentityClient` instance. Then retrieve the escape hatch with this code:

**Gradle Imports**

```groovy
implementation "aws.sdk.kotlin:cognitoidentityprovider:KOTLIN_SDK_VERSION"
implementation "aws.sdk.kotlin:cognitoidentity:KOTLIN_SDK_VERSION"
```
import android1 from "/src/fragments/lib/android-kotlin-java-interop.mdx";

<BlockSwitcher>

<Block name="Java">

<Fragments fragments={{android: android1}} />

```java
// Get the instance of AWSCognitoAuthPlugin
AWSCognitoAuthPlugin cognitoAuthPlugin = (AWSCognitoAuthPlugin) Amplify.Auth.getPlugin("awsCognitoAuthPlugin");

// Get the instance of CognitoIdentityProviderClient
CognitoIdentityProviderClient client = cognitoAuthPlugin.getEscapeHatch().getCognitoIdentityProviderClient();
ResendConfirmationCodeRequest request = ResendConfirmationCodeRequest.Companion.invoke(dslBuilder -> {
    dslBuilder.setClientId("xxxxxxxxxxxxxxxx");
    dslBuilder.setUsername("user1");
    return null;
});

assert client != null;
client.resendConfirmationCode(request, new Continuation<ResendConfirmationCodeResponse>() {
    @NonNull
    @Override
    public CoroutineContext getContext() {
        return GlobalScope.INSTANCE.getCoroutineContext();
    }

    @Override
    public void resumeWith(@NonNull Object resultOrException) {
        Log.i(TAG, "Result: " + resultOrException);
    }
});
```

</Block>

<Block name="Kotlin">

```kotlin
suspend fun resendCodeUsingEscapeHatch() {
    // Get the instance of AWSCognitoAuthPlugin
    val cognitoAuthPlugin = Amplify.Auth.getPlugin("awsCognitoAuthPlugin")
    val cognitoAuthService = cognitoAuthPlugin.escapeHatch as AWSCognitoAuthService

    // Get the instance of CognitoIdentityProviderClient
    val cognitoIdentityProviderClient = cognitoAuthService.cognitoIdentityProviderClient
    val request = ResendConfirmationCodeRequest {
        clientId = "xxxxxxxxxxxxxxxx"
        username = "user1"
    }
    val response = cognitoIdentityProviderClient?.resendConfirmationCode(request)
}
```

</Block>

</BlockSwitcher>
