Sitelet https://web.archive.org/web/20210819222013/https://github.com/aws-amplify/amplify-js/issues/8169
Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Verifying a new email causes Auth.currentAuthenticatedUser / .signIn to always return unverified email. #8169

Open
3 tasks done
AndyW22 opened this issue Apr 24, 2021 · 3 comments

Comments

@AndyW22
Copy link
Task lists! Give feedback

@AndyW22 AndyW22 commented Apr 24, 2021 •

Before opening, please confirm:

JavaScript Framework

React

Amplify APIs

Authentication

Amplify Categories

auth

Environment information

# Put output below this line
System:
    OS: macOS 11.2.3
    CPU: (8) x64 Apple M1
    Memory: 95.40 MB / 8.00 GB
    Shell: 3.2.57 - /bin/bash
  Binaries:
    Node: 15.5.0 - /usr/local/bin/node
    Yarn: 1.22.10 - /usr/local/bin/yarn
    npm: 7.5.4 - /usr/local/bin/npm
  Browsers:
    Chrome: 90.0.4430.85
    Firefox: 88.0
    Safari: 14.0.3
  npmPackages:
    @ampproject/toolbox-optimizer:  undefined ()
    @babel/core:  undefined ()
    @material-ui/core: ^4.11.3 => 4.11.3 
    @material-ui/icons: ^4.11.2 => 4.11.2 
    @material-ui/lab: ^4.0.0-alpha.57 => 4.0.0-alpha.57 
    @reduxjs/toolkit: ^1.5.0 => 1.5.1 
    @types/jest: ^26.0.22 => 26.0.22 
    @types/react: ^17.0.3 => 17.0.3 
    @types/react-google-recaptcha: ^2.1.0 => 2.1.0 
    @types/react-material-ui-form-validator: ^2.1.0 => 2.1.0 
    @types/redux-logger: ^3.0.8 => 3.0.8 
    @types/styled-components: ^5.1.9 => 5.1.9 
    @typescript-eslint/eslint-plugin: ^4.19.0 => 4.22.0 
    @typescript-eslint/parser: ^4.19.0 => 4.22.0 
    amphtml-validator:  undefined ()
    arg:  undefined ()
    async-retry:  undefined ()
    async-sema:  undefined ()
    aws-amplify: ^3.3.26 => 3.3.27 
    bfj:  undefined ()
    cacache:  undefined ()
    cache-loader:  undefined ()
    ci-info:  undefined ()
    comment-json:  undefined ()
    compression:  undefined ()
    conf:  undefined ()
    content-type:  undefined ()
    cookie:  undefined ()
    css-loader:  undefined ()
    cypress: 7.1.0 => 7.1.0 
    debug:  undefined ()
    devalue:  undefined ()
    escape-string-regexp:  undefined ()
    eslint: ^7.22.0 => 7.24.0 
    eslint-config-prettier: ^8.1.0 => 8.2.0 
    eslint-plugin-react: ^7.23.1 => 7.23.2 
    file-loader:  undefined ()
    find-cache-dir:  undefined ()
    find-up:  undefined ()
    fresh:  undefined ()
    gzip-size:  undefined ()
    http-proxy:  undefined ()
    ignore-loader:  undefined ()
    is-animated:  undefined ()
    is-docker:  undefined ()
    is-wsl:  undefined ()
    json5:  undefined ()
    jsonwebtoken:  undefined ()
    loader-utils:  undefined ()
    lodash.curry:  undefined ()
    lru-cache:  undefined ()
    mocha: ^8.3.2 => 8.3.2 
    mochawesome: 4.1.0 => 4.1.0 
    nanoid:  undefined ()
    neo-async:  undefined ()
    next: 10.0.9 => 10.0.9 
    next-redux-wrapper: ^7.0.0-rc.2 => 7.0.0-rc.2 
    ora:  undefined ()
    postcss-flexbugs-fixes:  undefined ()
    postcss-loader:  undefined ()
    postcss-preset-env:  undefined ()
    postcss-scss:  undefined ()
    prettier: ^2.2.1 => 2.2.1 
    react: 17.0.2 => 17.0.2 (16.14.0)
    react-dom: 17.0.2 => 17.0.2 (16.14.0)
    react-google-recaptcha: ^2.1.0 => 2.1.0 
    react-material-ui-form-validator: ^2.1.4 => 2.1.4 
    react-redux: ^7.2.3 => 7.2.3 
    react-responsive-modal: ^6.0.1 => 6.0.1 
    recast:  undefined ()
    redux-logger: ^3.0.6 => 3.0.6 
    resolve-url-loader:  undefined ()
    sass-loader:  undefined ()
    schema-utils:  undefined ()
    semver:  undefined ()
    send:  undefined ()
    source-map:  undefined ()
    start-server-and-test: ^1.12.1 => 1.12.1 
    string-hash:  undefined ()
    strip-ansi:  undefined ()
    styled-components: ^5.2.3 => 5.2.3 
    styled-components/macro:  undefined ()
    styled-components/native:  undefined ()
    styled-components/primitives:  undefined ()
    terser:  undefined ()
    text-table:  undefined ()
    thread-loader:  undefined ()
    typescript: ^4.2.3 => 4.2.4 
    unistore:  undefined ()
    web-vitals:  undefined ()
    webpack:  undefined ()
    webpack-sources:  undefined ()
  npmGlobalPackages:
    @aws-amplify/cli: 4.41.2
    eslint: 7.16.0
    nodemon: 2.0.7
    npm: 7.5.4
    react-devtools: 4.10.1
    source-map-explorer: 2.5.2
    yarn: 1.22.10

Describe the bug

Updating users email will cause Auth.currentAuthenticatedUser() or Auth.signIn to always return verified_email: false despite cognito saying they are confirmed + verified.

This is very problematic as it causes a user to be permanantly locked out, if the user tries to verify their email it returns "user is already confirmed", but they can't sign in to my app because it requires a verified email. Theres no way for the user to now verify their email (since it should already be verified) and the user has to re sign up for it to work again.

Expected behavior

Once updating the users email, Auth.currentAuthenticatedUser() and Auth.signIn should be returning correct data from cognito, that the email is verified.

Reproduction steps

const data = await Auth.currentAuthenticatedUser(); await Auth.updateUserAttributes(data, { "email": email, });

Once a code is emailed:

const result = await Auth.verifyCurrentUserAttributeSubmit("email", code);

result returns "SUCCESS" and the new email is confirmed and verified on the cognito console.

const data = await Auth.currentAuthenticatedUser(); will now return the user with the correct email but it will say its unverified and it can't be changed.

Code Snippet

// Put your code below this line.

Log output

// Put your logs below this line


aws-exports.js

No response

Manual configuration

Additional configuration

No response

Mobile Device

No response

Mobile Operating System

No response

Mobile Browser

No response

Mobile Browser Version

No response

Additional information and screenshots

My auth settings:

image

  • cognito userpool is imported, which may be the source of the issue.
  • My cognito pool has the option enabled to sign in with verified email.
@stale
Copy link

@stale stale bot commented Jun 9, 2021

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale
Copy link

@stale stale bot commented Jul 21, 2021

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

@stale stale bot closed this Jul 21, 2021
@chrisbonifacio chrisbonifacio added this to Needs Triage in Issues Triaging via automation Jul 21, 2021
@chrisbonifacio chrisbonifacio moved this from Needs Triage to To Be Reproduced in Issues Triaging Jul 21, 2021
@Khairo-kh
Copy link
Contributor

@Khairo-kh Khairo-kh commented Jul 22, 2021 •

Hello @AndyW22! Does this issue persist after signing out then signing back in? or are you getting locked out because the email is not verified? I just tested this and it looks like everything is working fine. Can you please provide a little more details on this?

Keep in mind that Auth.currentAuthenticatedUser() without any passed parameter will use the cache to get the information about the authenticated user. This is why you will still see the property email_verified: false when calling the function with defaults (even after verifying the email). To bypass the cache and get the latest user data you can pass options as follows:

Auth.currentAuthenticatedUser({
     bypassCache: true
});

Let me know if that helps with the issue. Otherwise, please provide a little more details on how you are getting the problem and I will be happy to help!

@chrisbonifacio chrisbonifacio moved this from To Be Reproduced to Pending Triage in Issues Triaging Aug 17, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Issues Triaging
Pending Triage
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
3 participants