Repository: aws-amplify/amplify-flutter

Issue #1716: Merge Accounts in PreSignUp Trigger causes "Already found an entry for username" exception 
Created: 2022-06-12T10:57:02Z
Description
When using the following PreSignUp lambda function to merge two accounts (OAuth and native cognito accounts), and allow users to use either options to signup, an exception is raised in the login flow, when the user initially creates their account. After the first sign up, the flow works as expected.
There are stackoverflow threads and blog posts on how to work around this issue, e.g. restarting the auth flow, or just not using adminLinkProviderForUser function:

https://stackoverflow.com/questions/47815161/cognito-auth-flow-fails-with-already-found-an-entry-for-username-facebook-10155
https://bobbyhadz.com/blog/aws-cognito-amplify-bad-bugged#oauth-registration-with-amplify

My PreSignUp trigger is based on: https://bobbyhadz.com/blog/aws-cognito-link-user-accounts
I use an entire custom flow to replace a password-based login with an OTP flow, based on this aws blog post https://aws.amazon.com/de/blogs/mobile/implementing-passwordless-email-authentication-with-amazon-cognito/
Exception:
 AuthException(message: invalid_request: Already found an entry for username zPW8WMWZaBQLkE9JRMBkonMdvfI1WJ/Ds0K0pgQTM/g=, recoverySuggestion: Retry the webUi signIn, underlyingException: Der Vorgang konnte nicht abgeschlossen werden. (com.amazon.cognito.AWSCognitoAuthErrorDomain-Fehler -3000.))
PreSignUp Trigger lambda function:
import {
  Context,
  PreSignUpTriggerEvent,
  PreSignUpTriggerHandler,
} from "aws-lambda";
import { CognitoIdentityServiceProvider } from "aws-sdk";
import {
  AdminLinkProviderForUserResponse,
  AdminSetUserPasswordResponse,
  ListUsersResponse,
} from "aws-sdk/clients/cognitoidentityserviceprovider";

export const autoConfirmUserHandler: PreSignUpTriggerHandler = async (
  event: PreSignUpTriggerEvent,
  _context: Context
) => {
  const {
    triggerSource,
    userPoolId,
    userName,
    request: {
      // only properties specified as required are available here
      userAttributes: { email },
    },
  } = event;

  const EXTERNAL_AUTHENTICATION_PROVIDER = "PreSignUp_ExternalProvider";

  if (triggerSource === EXTERNAL_AUTHENTICATION_PROVIDER) {
    // --> User has registered with Google/Facebook external providers
    const usersFilteredByEmail = await listUsersByEmail({
      userPoolId,
      email,
    });

    // userName example: "Facebook_12324325436" or "Google_1237823478"
    const [providerNameValue, providerUserId] = userName.split("_");
    // Uppercase the first letter because the event sometimes
    // has it as google_1234 or facebook_1234. In the call to `adminLinkProviderForUser`
    // the provider name has to be Google or Facebook (first letter capitalized)
    const providerName =
      providerNameValue.charAt(0).toUpperCase() + providerNameValue.slice(1);

    if (usersFilteredByEmail.Users && usersFilteredByEmail.Users.length > 0) {
      // user already has cognito account
      const cognitoUsername =
        usersFilteredByEmail.Users[0].Username || "username-not-found";

      // if they have access to the Google / Facebook account of email X, verify their email.
      // even if their cognito native account is not verified
      await adminLinkUserAccounts({
        username: cognitoUsername,
        userPoolId,
        providerName,
        providerUserId,
      });
    } else {
      /* --> user does not have a cognito native account ->
            1. create a native cognito account
            2. change the password, to change status from FORCE_CHANGE_PASSWORD to CONFIRMED
            3. merge the social and the native accounts
            4. add the user to a group - OPTIONAL
        */

      const createdCognitoUser = await adminCreateUser({
        userPoolId,
        email,
      });

      await adminSetUserPassword({ userPoolId, email });

      const cognitoNativeUsername =
        createdCognitoUser.User?.Username || "username-not-found";

      await adminLinkUserAccounts({
        username: cognitoNativeUsername,
        userPoolId,
        providerName,
        providerUserId,
      });

      event.response.autoVerifyEmail = true;
    }
  }

  event.response.autoConfirmUser = true;

  return event;
};

/**
 * Gets a list of users based on an email within a pool
 * @param param0
 * @returns
 */
export const listUsersByEmail = async ({
  userPoolId,
  email,
}: {
  userPoolId: string;
  email: string;
}): Promise<ListUsersResponse> => {
  const params = {
    UserPoolId: userPoolId,
    Filter: `email = "${email}"`,
  };

  const cognitoIdp = new CognitoIdentityServiceProvider();
  return cognitoIdp.listUsers(params).promise();
};

export const adminLinkUserAccounts = async ({
  username,
  userPoolId,
  providerName,
  providerUserId,
}: {
  username: string;
  userPoolId: string;
  providerName: string;
  providerUserId: string;
}): Promise<AdminLinkProviderForUserResponse> => {
  const params = {
    DestinationUser: {
      ProviderAttributeValue: username,
      ProviderName: "Cognito",
    },
    SourceUser: {
      ProviderAttributeName: "Cognito_Subject",
      ProviderAttributeValue: providerUserId,
      ProviderName: providerName,
    },
    UserPoolId: userPoolId,
  };

  const cognitoIdp = new CognitoIdentityServiceProvider();
  return new Promise((resolve, reject) => {
    cognitoIdp.adminLinkProviderForUser(params, (err, data) => {
      if (err) {
        reject(err);
        return;
      }
      resolve(data);
    });
  });
};

/**
 * Creates a cognito user
 * @param param0
 * @returns
 */
export const adminCreateUser = async ({
  userPoolId,
  email,
}: {
  userPoolId: string;
  email: string;
}): Promise<AWS.CognitoIdentityServiceProvider.AdminCreateUserResponse> => {
  const createUserParams = {
    UserPoolId: userPoolId,
    // SUPPRESS prevents sending an email with the temporary password
    // to the user on account creation
    MessageAction: "SUPPRESS",
    Username: email,
    UserAttributes: [
      {
        Name: "email",
        Value: email,
      },
      {
        Name: "email_verified",
        Value: "true",
      },
    ],
  };

  const cognitoIdp = new CognitoIdentityServiceProvider();
  return cognitoIdp.adminCreateUser(createUserParams).promise();
};

/**
 * Sets a random password for an account
 * @param param0
 * @returns
 */
export const adminSetUserPassword = async ({
  userPoolId,
  email,
}: {
  userPoolId: string;
  email: string;
}): Promise<AdminSetUserPasswordResponse> => {
  const params = {
    Password: generatePassword(),
    UserPoolId: userPoolId,
    Username: email,
    Permanent: true,
  };

  const cognitoIdp = new CognitoIdentityServiceProvider();
  return cognitoIdp.adminSetUserPassword(params).promise();
};

/**
 * Generates a random password
 * @returns
 */
function generatePassword() {
  return `${Math.random() // Generate random number, eg: 0.123456
    .toString(36) // Convert  to base-36 : "0.4fzyo82mvyr"
    .slice(-16)}42T`; // Cut off last 16 characters; and add a number and uppercase character to match cognito password policy
}
Categories

 Analytics
 API (REST)
 API (GraphQL)
 Auth
 Authenticator
 DataStore
 Storage

Steps to Reproduce

Use provided PreSignUp Trigger
Call the following in your flutter app to sign up with Google/Apple the very first time:

      await Amplify.Auth.signInWithWebUI(
        provider: provider,
      );
Screenshots
No response
Platforms

 iOS
 Android

Android Device/Emulator API Level
No response
Environment
Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel stable, 3.0.0, on macOS 12.3.1 21E258 darwin-x64, locale en-GB)
[✓] Android toolchain - develop for Android devices (Android SDK version 30.0.3)
[✓] Xcode - develop for iOS and macOS (Xcode 13.4.1)
[✓] Chrome - develop for the web
[✓] Android Studio (version 2021.1)
[✓] IntelliJ IDEA Community Edition (version 2021.3)
[✓] VS Code (version 1.68.0)
[✓] Connected device (3 available)
[✓] HTTP Host Availability

• No issues found!
Dependencies

Click to show
Dart SDK 2.17.0
Flutter SDK 3.0.0
my_app 1.3.1+66

dependencies:
- amplify_auth_cognito 0.5.1 [amplify_auth_cognito_android amplify_auth_cognito_ios amplify_auth_plugin_interface amplify_core collection flutter plugin_platform_interface]
- amplify_flutter 0.5.1 [amplify_analytics_plugin_interface amplify_api_plugin_interface amplify_auth_plugin_interface amplify_core amplify_datastore_plugin_interface amplify_flutter_android amplify_flutter_ios amplify_storage_plugin_interface collection flutter json_annotation meta plugin_platform_interface]
- animate_do 2.1.0 [flutter]
- app_settings 4.1.6 [flutter]
- auto_size_text 3.0.0 [flutter]
- basic_utils 4.2.2 [http logging json_annotation pointycastle]
- bloc 8.0.3 [meta]
- chopper 4.0.5 [http meta logging]
- collection 1.16.0
- connectivity_plus 2.3.0 [flutter connectivity_plus_platform_interface connectivity_plus_linux connectivity_plus_macos connectivity_plus_web connectivity_plus_windows]
- device_info_plus 3.2.3 [flutter device_info_plus_platform_interface device_info_plus_macos device_info_plus_linux device_info_plus_web device_info_plus_windows]
- dots_indicator 2.1.0 [flutter]
- equatable 2.0.3 [collection meta]
- firebase_analytics 9.1.8 [firebase_analytics_platform_interface firebase_analytics_web firebase_core firebase_core_platform_interface flutter]
- firebase_core 1.17.0 [firebase_core_platform_interface firebase_core_web flutter meta]
- firebase_crashlytics 2.8.0 [firebase_core firebase_core_platform_interface firebase_crashlytics_platform_interface flutter stack_trace]
- firebase_dynamic_links 4.2.4 [firebase_core firebase_core_platform_interface firebase_dynamic_links_platform_interface flutter meta plugin_platform_interface]
- firebase_messaging 11.4.0 [firebase_core firebase_core_platform_interface firebase_messaging_platform_interface firebase_messaging_web flutter meta]
- flow_builder 0.0.8 [flutter]
- flutter 0.0.0 [characters collection material_color_utilities meta vector_math sky_engine]
- flutter_app_badger 1.4.0 [flutter]
- flutter_bloc 8.0.1 [flutter bloc provider]
- flutter_config 2.0.0 [flutter]
- flutter_feather_icons 2.0.0+1 [flutter]
- flutter_inappwebview 5.4.3+7 [flutter]
- flutter_jailbreak_detection 1.8.0 [flutter]
- flutter_keyboard_visibility 5.2.0 [meta flutter_keyboard_visibility_platform_interface flutter_keyboard_visibility_web flutter]
- flutter_lints 1.0.4 [lints]
- flutter_local_notifications 9.5.3+1 [clock flutter flutter_local_notifications_linux flutter_local_notifications_platform_interface timezone]
- flutter_localizations 0.0.0 [flutter intl characters clock collection material_color_utilities meta path vector_math]
- flutter_svg 1.0.3 [flutter meta path_drawing vector_math xml]
- formz 0.4.1
- functional_widget_annotation 0.9.2
- google_maps_flutter 2.1.5 [flutter flutter_plugin_android_lifecycle google_maps_flutter_platform_interface]
- hydrated_bloc 8.1.0 [bloc hive meta synchronized]
- implicitly_animated_list 2.1.0 [flutter list_diff]
- in_app_purchase 3.0.4 [flutter in_app_purchase_android in_app_purchase_platform_interface in_app_purchase_storekit]
- intl 0.17.0 [clock path]
- intl_phone_number_input 0.7.0+2 [flutter meta libphonenumber_plugin equatable collection]
- json_annotation 4.5.0 [meta]
- loader_overlay 2.0.7 [flutter back_button_interceptor]
- location 4.4.0 [flutter location_platform_interface location_web]
- logger 1.1.0
- maps_toolkit 2.0.0
- material_floating_search_bar 0.3.7 [flutter meta]
- package_info_plus 1.4.2 [flutter package_info_plus_platform_interface package_info_plus_linux package_info_plus_macos package_info_plus_windows package_info_plus_web]
- permission_handler 9.2.0 [flutter meta permission_handler_android permission_handler_apple permission_handler_windows permission_handler_platform_interface]
- pin_code_fields 7.4.0 [flutter]
- pull_to_refresh 2.0.0 [flutter]
- rflutter_alert 2.0.4 [flutter]
- rxdart 0.27.3
- secure_storage 0.0.2 [flutter]
- shared_preferences 2.0.15 [flutter shared_preferences_android shared_preferences_ios shared_preferences_linux shared_preferences_macos shared_preferences_platform_interface shared_preferences_web shared_preferences_windows]
- sign_in_with_apple 3.3.0 [flutter meta sign_in_with_apple_platform_interface sign_in_with_apple_web]
- store_redirect 2.0.1 [flutter]
- stream_chat_flutter 3.6.1 [cached_network_image characters chewie collection diacritic dio ezanimation file_picker flutter flutter_markdown flutter_portal flutter_slidable flutter_svg http_parser image_gallery_saver image_picker jiffy lottie meta path_provider photo_manager photo_view rxdart share_plus shimmer stream_chat_flutter_core substring_highlight synchronized url_launcher video_compress video_player video_thumbnail]
- stream_chat_localizations 2.1.0 [flutter flutter_localizations stream_chat_flutter]
- stream_chat_persistence 3.1.0 [drift flutter logging meta mutex path path_provider sqlite3_flutter_libs stream_chat]
- synchronized 3.0.0+2
- tuple 2.0.0 [quiver]
- url_launcher 6.1.2 [flutter url_launcher_android url_launcher_ios url_launcher_linux url_launcher_macos url_launcher_platform_interface url_launcher_web url_launcher_windows]
- uuid 3.0.6 [crypto]
- webview_flutter 3.0.4 [flutter webview_flutter_android webview_flutter_platform_interface webview_flutter_wkwebview]

dependency overrides:
- flutter_svg 1.0.3 [flutter meta path_drawing vector_math xml]
- provider 6.0.3 [collection flutter nested]

transitive dependencies:
- amplify_analytics_plugin_interface 0.5.1 [amplify_core flutter meta]
- amplify_api_plugin_interface 0.5.1 [amplify_core collection flutter json_annotation meta]
- amplify_auth_cognito_android 0.5.1 [flutter]
- amplify_auth_cognito_ios 0.5.1 [amplify_core flutter]
- amplify_auth_plugin_interface 0.5.1 [amplify_core flutter meta]
- amplify_core 0.5.1 [collection date_time_format flutter meta plugin_platform_interface uuid]
- amplify_datastore_plugin_interface 0.5.1 [flutter meta collection amplify_core]
- amplify_flutter_android 0.5.1 [flutter]
- amplify_flutter_ios 0.5.1 [amplify_core flutter]
- amplify_storage_plugin_interface 0.5.1 [flutter meta amplify_core]
- archive 3.3.0 [crypto path]
- args 2.3.1
- asn1lib 1.1.0
- async 2.9.0 [collection meta]
- back_button_interceptor 6.0.0 [collection flutter]
- cached_network_image 3.2.1 [flutter flutter_cache_manager octo_image cached_network_image_platform_interface cached_network_image_web]
- cached_network_image_platform_interface 1.0.0 [flutter flutter_cache_manager]
- cached_network_image_web 1.0.1 [flutter flutter_cache_manager cached_network_image_platform_interface]
- characters 1.2.0
- charcode 1.3.1
- chewie 1.3.3 [cupertino_icons flutter provider video_player wakelock]
- clock 1.1.0
- connectivity_plus_linux 1.3.0 [flutter connectivity_plus_platform_interface meta nm]
- connectivity_plus_macos 1.2.2 [connectivity_plus_platform_interface flutter]
- connectivity_plus_platform_interface 1.2.0 [flutter meta plugin_platform_interface]
- connectivity_plus_web 1.2.0 [connectivity_plus_platform_interface flutter_web_plugins flutter]
- connectivity_plus_windows 1.2.0 [connectivity_plus_platform_interface flutter]
- convert 3.0.1 [typed_data]
- cross_file 0.3.3+1 [js meta]
- crypto 3.0.2 [typed_data]
- crypto_keys 0.3.0 [pointycastle meta collection quiver]
- csslib 0.17.1 [source_span]
- cupertino_icons 1.0.4
- date_time_format 2.0.1
- dbus 0.7.3 [args ffi meta xml]
- device_info_plus_linux 2.1.1 [device_info_plus_platform_interface file flutter meta]
- device_info_plus_macos 2.2.3 [device_info_plus_platform_interface flutter]
- device_info_plus_platform_interface 2.3.0+1 [flutter meta plugin_platform_interface]
- device_info_plus_web 2.1.0 [device_info_plus_platform_interface flutter_web_plugins flutter]
- device_info_plus_windows 2.1.1 [device_info_plus_platform_interface ffi flutter win32]
- diacritic 0.1.3
- dio 4.0.6 [http_parser path]
- drift 1.3.0 [async convert collection meta stream_channel sqlite3]
- ezanimation 0.6.0 [flutter]
- ffi 1.2.1
- file 6.1.2 [meta path]
- file_picker 4.5.1 [flutter flutter_web_plugins flutter_plugin_android_lifecycle plugin_platform_interface ffi path win32]
- firebase_analytics_platform_interface 3.1.6 [firebase_core flutter meta plugin_platform_interface]
- firebase_analytics_web 0.4.0+13 [firebase_analytics_platform_interface firebase_core firebase_core_web flutter flutter_web_plugins js]
- firebase_core_platform_interface 4.4.0 [collection flutter meta plugin_platform_interface]
- firebase_core_web 1.6.4 [firebase_core_platform_interface flutter flutter_web_plugins js meta]
- firebase_crashlytics_platform_interface 3.2.6 [collection firebase_core flutter meta plugin_platform_interface]
- firebase_dynamic_links_platform_interface 0.2.3+2 [firebase_core flutter meta plugin_platform_interface]
- firebase_messaging_platform_interface 3.5.0 [firebase_core flutter meta plugin_platform_interface]
- firebase_messaging_web 2.4.0 [firebase_core firebase_core_web firebase_messaging_platform_interface flutter flutter_web_plugins js meta]
- flutter_blurhash 0.7.0 [flutter]
- flutter_cache_manager 3.3.0 [clock collection file flutter http path path_provider pedantic rxdart sqflite uuid]
- flutter_keyboard_visibility_platform_interface 2.0.0 [flutter meta plugin_platform_interface]
- flutter_keyboard_visibility_web 2.0.0 [flutter_keyboard_visibility_platform_interface flutter_web_plugins flutter]
- flutter_local_notifications_linux 0.4.2 [flutter flutter_local_notifications_platform_interface dbus path xdg_directories]
- flutter_local_notifications_platform_interface 5.0.0 [flutter plugin_platform_interface]
- flutter_markdown 0.6.10+1 [flutter markdown meta path]
- flutter_plugin_android_lifecycle 2.0.6 [flutter]
- flutter_portal 0.4.0 [flutter]
- flutter_slidable 0.6.0 [flutter]
- flutter_web_plugins 0.0.0 [flutter js characters collection material_color_utilities meta vector_math]
- freezed_annotation 1.1.0 [collection json_annotation meta]
- google_maps_flutter_platform_interface 2.1.7 [collection flutter plugin_platform_interface stream_transform]
- hive 2.2.1 [meta crypto]
- html 0.15.0 [csslib source_span]
- http 0.13.4 [async http_parser meta path]
- http_parser 4.0.1 [collection source_span string_scanner typed_data]
- image_gallery_saver 1.7.1 [flutter]
- image_picker 0.8.5+3 [flutter image_picker_android image_picker_for_web image_picker_ios image_picker_platform_interface]
- image_picker_android 0.8.4+13 [flutter flutter_plugin_android_lifecycle image_picker_platform_interface]
- image_picker_for_web 2.1.8 [flutter flutter_web_plugins image_picker_platform_interface]
- image_picker_ios 0.8.5+5 [flutter image_picker_platform_interface]
- image_picker_platform_interface 2.5.0 [cross_file flutter http plugin_platform_interface]
- in_app_purchase_android 0.2.2+6 [collection flutter in_app_purchase_platform_interface json_annotation]
- in_app_purchase_platform_interface 1.3.1 [flutter plugin_platform_interface]
- in_app_purchase_storekit 0.3.0+8 [collection flutter in_app_purchase_platform_interface json_annotation]
- jiffy 5.0.0 [intl]
- jose 0.3.2 [crypto_keys meta typed_data x509 http http_parser asn1lib collection]
- js 0.6.4
- libphonenumber 2.0.2 [flutter meta]
- libphonenumber_platform_interface 0.3.1 [flutter plugin_platform_interface]
- libphonenumber_plugin 0.2.3 [flutter flutter_web_plugins libphonenumber_platform_interface libphonenumber_web libphonenumber]
- libphonenumber_web 0.2.0+1 [flutter flutter_web_plugins js libphonenumber_platform_interface]
- lints 1.0.1
- list_diff 2.0.1 [async]
- location_platform_interface 2.3.0 [flutter meta plugin_platform_interface]
- location_web 3.1.1 [flutter flutter_web_plugins http_parser js location_platform_interface meta]
- logging 1.0.2
- lottie 1.3.0 [archive flutter path vector_math]
- markdown 5.0.0 [args charcode meta]
- matcher 0.12.11 [stack_trace]
- material_color_utilities 0.1.4
- meta 1.7.0
- mime 1.0.2
- mutex 3.0.0
- nested 1.0.0 [flutter]
- nm 0.5.0 [dbus]
- octo_image 1.0.2 [flutter flutter_blurhash]
- package_info_plus_linux 1.0.5 [package_info_plus_platform_interface flutter path]
- package_info_plus_macos 1.3.0 [flutter]
- package_info_plus_platform_interface 1.0.2 [flutter meta plugin_platform_interface]
- package_info_plus_web 1.0.5 [flutter flutter_web_plugins http meta package_info_plus_platform_interface]
- package_info_plus_windows 1.0.5 [package_info_plus_platform_interface ffi flutter win32]
- path 1.8.1
- path_drawing 1.0.0 [vector_math meta path_parsing flutter]
- path_parsing 1.0.0 [vector_math meta]
- path_provider 2.0.10 [flutter path_provider_android path_provider_ios path_provider_linux path_provider_macos path_provider_platform_interface path_provider_windows]
- path_provider_android 2.0.14 [flutter path_provider_platform_interface]
- path_provider_ios 2.0.9 [flutter path_provider_platform_interface]
- path_provider_linux 2.1.6 [ffi flutter path path_provider_platform_interface xdg_directories]
- path_provider_macos 2.0.6 [flutter path_provider_platform_interface]
- path_provider_platform_interface 2.0.4 [flutter platform plugin_platform_interface]
- path_provider_windows 2.0.6 [ffi flutter path path_provider_platform_interface win32]
- pedantic 1.11.1
- permission_handler_android 9.0.2+1 [flutter permission_handler_platform_interface]
- permission_handler_apple 9.0.4 [flutter permission_handler_platform_interface]
- permission_handler_platform_interface 3.7.0 [flutter meta plugin_platform_interface]
- permission_handler_windows 0.1.0 [flutter permission_handler_platform_interface]
- petitparser 5.0.0 [meta]
- photo_manager 2.1.1 [flutter]
- photo_view 0.13.0 [flutter]
- platform 3.1.0
- plugin_platform_interface 2.1.2 [meta]
- pointycastle 3.6.0 [collection convert js]
- process 4.2.4 [file path platform]
- quiver 3.1.0 [matcher]
- rate_limiter 0.1.1
- share_plus 4.0.4 [meta mime flutter share_plus_platform_interface share_plus_linux share_plus_macos share_plus_windows share_plus_web]
- share_plus_linux 3.0.0 [share_plus_platform_interface file flutter meta url_launcher]
- share_plus_macos 3.0.0 [share_plus_platform_interface flutter]
- share_plus_platform_interface 3.0.2 [flutter meta mime plugin_platform_interface]
- share_plus_web 3.0.0 [share_plus_platform_interface url_launcher flutter flutter_web_plugins meta]
- share_plus_windows 3.0.0 [share_plus_platform_interface flutter meta url_launcher]
- shared_preferences_android 2.0.12 [flutter shared_preferences_platform_interface]
- shared_preferences_ios 2.1.1 [flutter shared_preferences_platform_interface]
- shared_preferences_linux 2.1.1 [file flutter path path_provider_linux path_provider_platform_interface shared_preferences_platform_interface]
- shared_preferences_macos 2.0.4 [flutter shared_preferences_platform_interface]
- shared_preferences_platform_interface 2.0.0 [flutter]
- shared_preferences_web 2.0.4 [flutter flutter_web_plugins shared_preferences_platform_interface]
- shared_preferences_windows 2.1.1 [file flutter path path_provider_platform_interface path_provider_windows shared_preferences_platform_interface]
- shimmer 2.0.0 [flutter]
- sign_in_with_apple_platform_interface 1.0.0 [flutter plugin_platform_interface meta]
- sign_in_with_apple_web 1.0.1 [flutter flutter_web_plugins sign_in_with_apple_platform_interface js]
- sky_engine 0.0.99
- source_span 1.9.0 [collection path term_glyph]
- sqflite 2.0.2+1 [flutter sqflite_common path]
- sqflite_common 2.2.1+1 [synchronized path meta]
- sqlite3 1.7.1 [collection ffi js meta path]
- sqlite3_flutter_libs 0.5.7 [flutter]
- stack_trace 1.10.0 [path]
- stream_channel 2.1.0 [async]
- stream_chat 3.6.1 [async collection dio equatable freezed_annotation http_parser jose json_annotation logging meta mime rate_limiter rxdart uuid web_socket_channel]
- stream_chat_flutter_core 3.6.1 [collection connectivity_plus flutter meta rxdart stream_chat]
- stream_transform 2.0.0
- string_scanner 1.1.1 [source_span]
- substring_highlight 1.0.33 [flutter]
- term_glyph 1.2.0
- timezone 0.8.0 [path]
- typed_data 1.3.1 [collection]
- url_launcher_android 6.0.17 [flutter url_launcher_platform_interface]
- url_launcher_ios 6.0.17 [flutter url_launcher_platform_interface]
- url_launcher_linux 3.0.1 [flutter url_launcher_platform_interface]
- url_launcher_macos 3.0.1 [flutter url_launcher_platform_interface]
- url_launcher_platform_interface 2.0.5 [flutter plugin_platform_interface]
- url_launcher_web 2.0.11 [flutter flutter_web_plugins url_launcher_platform_interface]
- url_launcher_windows 3.0.1 [flutter url_launcher_platform_interface]
- vector_math 2.1.2
- video_compress 3.1.0 [flutter]
- video_player 2.4.2 [flutter html video_player_android video_player_avfoundation video_player_platform_interface video_player_web]
- video_player_android 2.3.4 [flutter video_player_platform_interface]
- video_player_avfoundation 2.3.4 [flutter video_player_platform_interface]
- video_player_platform_interface 5.1.2 [flutter plugin_platform_interface]
- video_player_web 2.0.10 [flutter flutter_web_plugins video_player_platform_interface]
- video_thumbnail 0.5.0 [flutter]
- wakelock 0.6.1+2 [flutter meta wakelock_macos wakelock_platform_interface wakelock_web wakelock_windows]
- wakelock_macos 0.4.0 [flutter flutter_web_plugins wakelock_platform_interface]
- wakelock_platform_interface 0.3.0 [flutter meta]
- wakelock_web 0.4.0 [flutter flutter_web_plugins js wakelock_platform_interface]
- wakelock_windows 0.2.0 [flutter wakelock_platform_interface win32]
- web_socket_channel 2.2.0 [async crypto stream_channel]
- webview_flutter_android 2.8.8 [flutter webview_flutter_platform_interface]
- webview_flutter_platform_interface 1.9.0 [flutter meta plugin_platform_interface]
- webview_flutter_wkwebview 2.7.5 [flutter path webview_flutter_platform_interface]
- win32 2.6.1 [ffi]
- x509 0.2.2 [asn1lib quiver crypto_keys]
- xdg_directories 0.2.0+1 [meta path process]
- xml 5.4.1 [collection meta petitparser]

Device
iPhone SE
OS
iOS 15.5
CLI Version
7.6.22
Additional Context
No response

Duplicate issue #580: Link existing user account in a user pool to an identity from an external identity provider
Created: 2021-05-15T01:03:08Z
Do we have existing solution for this feature of cognito?
https://docs.aws.amazon.com/cognito-user-identity-pools/latest/APIReference/API_AdminLinkProviderForUser.html
I really need this in linking accounts. Thank you.

Closing comment (2022-11-16T06:19:25Z): Closing as a duplicate of #1716. Please inform us if you think otherwise @gnsslrrcs