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

Could not find the TOTP key in the internal context #2401

Open
5 of 6 tasks
perjo927 opened this issue Apr 14, 2022 · 6 comments
Open
5 of 6 tasks

Could not find the TOTP key in the internal context #2401

perjo927 opened this issue Apr 14, 2022 · 6 comments
Labels
bug Something is not working.

Comments

@perjo927
Copy link

Preflight checklist

Describe the bug

In a browser client using Ory Kratos: After activating 2FA with TOTP by scanning the QR code retrieved from after initializing the settings flow and successfully inputting the verify code generated by the paired Authenticator app, then disabling and then going through activation a second time, during the same privileged session, the following error is thrown:

{
    "error": {
        "code": 500,
        "status": "Internal Server Error",
        "reason": "Could not find they TOTP key in the internal context. This is a code bug and should be reported to https://github.com/ory/kratos/.",
        "message": "An internal server error occurred, please contact the system administrator"
    }
}

Reproducing the bug

  1. Enable 2FA with TOTP in your Kratos configuration
  2. Activate 2FA by scanning QR code retrieved from initializing settings flow + entering verify code generated with the Authenticator app.
  3. Disable/unlink 2FA/TOTP
  4. Activate 2FA again by scanning QR code and enter verify code

I was able to reproduce both in my own browser client as well as in https://kratos-reference-ui-react-nextjs.vercel.app/

Relevant log output

{
    "error": {
        "code": 500,
        "status": "Internal Server Error",
        "reason": "Could not find they TOTP key in the internal context. This is a code bug and should be reported to https://github.com/ory/kratos/.",
        "message": "An internal server error occurred, please contact the system administrator"
    }
}

Relevant configuration

Was successfully reproduced in the example SPA/node app: https://kratos-reference-ui-react-nextjs.vercel.app/

Version

v0.9.0-alpha.3

On which operating system are you observing this issue?

macOS

In which environment are you deploying?

No response

Additional Context

https://github.com/ory/kratos-selfservice-ui-react-nextjs

@perjo927 perjo927 added the bug Something is not working. label Apr 14, 2022
@perjo927
Copy link
Author

If I log out and log in again, it starts working again, meaning I can activate TOTP verification again.

@aeneasr
Copy link
Member

aeneasr commented Apr 14, 2022

Thank you for the report, can you try doing the same flow you described, but loading a fresh settings flow - so calling the settings ui and removing the ?flow=... parameter? That should re-initialize the flow and reset the context.

This is still a bug though of course, I just want to see if that's the problem.

@perjo927
Copy link
Author

Yes, I was just about to try actually, will get back to you! :)

@perjo927
Copy link
Author

Hi @aeneasr . Your suggestion solves the issue.

Actually, I experienced a "related" problem, which was solved using the same method. If you'd like to, I can report this separately as well.

  1. Login.
  2. Go to settings.
  3. Update profile settings; for instance password or name.
  4. Scan QR code + link authenticator app, input verify/TOTP code.
  5. All attempts to input verify code results in a response with "invalid code".
  6. If I restart the flow, or login/logout, it becomes possible to pair and setup TOTP again.

@aeneasr
Copy link
Member

aeneasr commented Apr 14, 2022

Thank you! I think they have the same underlying problem so it's ok to keep track of it here :)

@perjo927
Copy link
Author

Great, thanks for responding so swiftly! :)

@perjo927 perjo927 changed the title Could not find they TOTP key in the internal context Could not find the TOTP key in the internal context Apr 15, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something is not working.
Projects
None yet
Development

No branches or pull requests

2 participants