aws-amplify / amplify-js

A declarative JavaScript library for application development using cloud services.
https://docs.amplify.aws/lib/q/platform/js
Apache License 2.0
9.42k stars 2.12k forks source link

autoVerifyEmail not working with identity providers #5287

Closed elledienne closed 4 years ago

elledienne commented 4 years ago

Describe the bug I created a pre-signup lambda trigger to set autoVerifyEmail = true and autoConfirmUser = true when users sign up using Facebook as IdP (when they sign up using Google I can simply use attributes mapping but Facebook doesn't seem to providing any attribute for that). The function seems to work perfectly when users sign up with email/password but has no effect when they sign up with Facebook.

To Reproduce

  1. Create this Lambda function
exports.handler = (event, context, callback) => {
  // Confirm the user
  event.response.autoConfirmUser = true;

  // Set the email as verified if it is in the request
  if (event.request.userAttributes.hasOwnProperty('email')) {
    event.response.autoVerifyEmail = true;
  }

  // Set the phone number as verified if it is in the request
  if (event.request.userAttributes.hasOwnProperty('phone_number')) {
    event.response.autoVerifyPhone = true;
  }

  // Return to Amazon Cognito
  callback(null, event);
};
  1. Assign the function as pre-signup trigger from Cognito UI

Expected behavior Created user should have the email_verified attribute

Screenshots Facebook

Environment ``` System: OS: macOS 10.15.3 CPU: (12) x64 Intel(R) Core(TM) i7-8850H CPU @ 2.60GHz Memory: 29.03 MB / 16.00 GB Shell: 5.7.1 - /bin/zsh Binaries: Node: 12.11.0 - /usr/local/bin/node Yarn: 1.19.2 - ~/.yarn/bin/yarn npm: 6.11.3 - /usr/local/bin/npm Watchman: 4.9.0 - /usr/local/bin/watchman Browsers: Chrome: 80.0.3987.149 Firefox: 72.0.2 Safari: 13.0.5 npmPackages: @apollo/react-hooks: ^3.1.3 => 3.1.3 @babel/core: ^7.6.2 => 7.8.3 @babel/runtime: ^7.6.2 => 7.8.3 @carimus/metro-symlinked-deps: ^1.1.0 => 1.1.0 @formatjs/intl-pluralrules: ^1.5.0 => 1.5.0 @formatjs/intl-relativetimeformat: ^4.5.7 => 4.5.7 @invertase/react-native-apple-authentication: ^0.1.1 => 0.1.1 @react-native-community/async-storage: ^1.8.1 => 1.8.1 @react-native-community/datetimepicker: ^2.2.2 => 2.2.2 @react-native-community/eslint-config: ^0.0.5 => 0.0.5 @react-native-community/masked-view: ^0.1.6 => 0.1.6 @react-native-community/netinfo: 4.7.0 => 4.7.0 amazon-cognito-identity-js: ^3.2.5 => 3.2.5 apollo-cache-inmemory: ^1.6.5 => 1.6.5 apollo-client: ^2.6.8 => 2.6.8 apollo-link: ^1.2.13 => 1.2.13 aws-amplify: ^2.2.6 => 2.2.6 aws-amplify-react-native: ^3.2.2 => 3.2.2 aws-appsync: ^3.0.2 => 3.0.2 aws-appsync-auth-link: ^2.0.1 => 2.0.1 aws-appsync-subscription-link: ^2.0.1 => 2.0.1 babel-jest: ^24.9.0 => 24.9.0 date-fns: ^2.11.0 => 2.11.0 eslint: ^6.5.1 => 6.8.0 graphql-tag: ^2.10.3 => 2.10.3 hoist-non-react-statics: ^3.3.2 => 3.3.2 jest: ^24.9.0 => 24.9.0 lodash: ^4.17.15 => 4.17.15 metro-react-native-babel-preset: ^0.56.0 => 0.56.4 query-string: ^6.11.1 => 6.11.1 react: 16.9.0 => 16.9.0 react-intl: ^3.11.0 => 3.11.0 react-native: 0.61.5 => 0.61.5 react-native-device-info: ^5.4.1 => 5.4.1 react-native-gesture-handler: ^1.5.3 => 1.5.3 react-native-get-random-values: ^1.3.1 => 1.3.1 react-native-gifted-chat: ^0.13.0 => 0.13.0 react-native-inappbrowser-reborn: ^3.3.4 => 3.3.4 react-native-linear-gradient: ^2.5.6 => 2.5.6 react-native-localize: ^1.3.2 => 1.3.2 react-native-modal: ^11.5.4 => 11.5.4 react-native-reanimated: ^1.7.0 => 1.7.0 react-native-safe-area-context: ^0.6.2 => 0.6.2 react-native-screens: ^2.0.0-alpha.25 => 2.0.0-alpha.25 react-native-spinkit: ^1.5.0 => 1.5.0 react-native-vector-icons: ^6.6.0 => 6.6.0 react-navigation: ^4.0.10 => 4.0.10 react-navigation-stack: ^2.0.15 => 2.0.15 react-navigation-tabs: ^2.7.0 => 2.7.0 react-test-renderer: 16.9.0 => 16.9.0 uuid: ^7.0.2 => 7.0.2 npmGlobalPackages: @aws-amplify/cli: 4.17.2 @twilio/autopilot-cli: 0.0.27 undefined: 1.2.7 aws-amplify-monorepo: 0.1.30 gatsby-cli: 2.7.45 lighthouse: 4.2.0 nodemon: 1.18.7 npm: 6.11.3 sequelize-cli: 5.4.0 ```

Smartphone (please complete the following information):

Amplifiyer commented 4 years ago

@elledienne, this looks like related to cognito and not Amplify. Can you create a support case with AWS cognito or post in Cognito forums?

stale[bot] commented 4 years ago

This issue has been automatically closed because of inactivity. Please open a new issue if are still encountering problems.

github-actions[bot] commented 3 years ago

This issue has been automatically locked since there hasn't been any recent activity after it was closed. Please open a new issue for related bugs.

Looking for a help forum? We recommend joining the Amplify Community Discord server *-help channels or Discussions for those types of questions.