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

Does not patch rest api #1

Open
Vindfrisk opened this issue Aug 18, 2020 · 13 comments · Fixed by #4
Open

Does not patch rest api #1

Vindfrisk opened this issue Aug 18, 2020 · 13 comments · Fixed by #4

Comments

@Vindfrisk
Copy link

Not sure if you intended to also patch this? Anyhow you cant create REST tokens because of 2fa limitation. See response below.

{
    "message": "Please ask an administrator with sufficient access to configure 2FA first",
    "trace": "#0 [internal function]: Magento\\TwoFactorAuth\\Model\\AdminAccessTokenService->createAdminAccessToken()\n#1 /var/www/magento2/vendor/magento/module-webapi/Controller/Rest/SynchronousRequestProcessor.php(95): call_user_func_array()\n#2 /var/www/magento2/vendor/magento/module-webapi/Controller/Rest.php(188): Magento\\Webapi\\Controller\\Rest\\SynchronousRequestProcessor->process()\n#3 /var/www/magento2/vendor/magento/framework/Interception/Interceptor.php(58): Magento\\Webapi\\Controller\\Rest->dispatch()\n#4 /var/www/magento2/vendor/magento/framework/Interception/Interceptor.php(138): Magento\\Webapi\\Controller\\Rest\\Interceptor->___callParent()\n#5 /var/www/magento2/vendor/magento/framework/Interception/Interceptor.php(153): Magento\\Webapi\\Controller\\Rest\\Interceptor->Magento\\Framework\\Interception\\{closure}()\n#6 /var/www/magento2/generated/code/Magento/Webapi/Controller/Rest/Interceptor.php(26): Magento\\Webapi\\Controller\\Rest\\Interceptor->___callPlugins()\n#7 /var/www/magento2/vendor/magento/framework/App/Http.php(116): Magento\\Webapi\\Controller\\Rest\\Interceptor->dispatch()\n#8 /var/www/magento2/generated/code/Magento/Framework/App/Http/Interceptor.php(24): Magento\\Framework\\App\\Http->launch()\n#9 /var/www/magento2/vendor/magento/framework/App/Bootstrap.php(263): Magento\\Framework\\App\\Http\\Interceptor->launch()\n#10 /var/www/magento2/pub/index.php(40): Magento\\Framework\\App\\Bootstrap->run()\n#11 {main}"
}
@markshust
Copy link
Owner

Thanks for the issue report @Vindfrisk. Yes, I'll keep this issue open and will take any PR's that make this work. I would think this module should disable any functionality of 2FA no matter where it is.

@zeeshan2523806
Copy link

@markshust @Vindfrisk do you guyz have any luck with it ? If not then i can create the patch and submit PR for it ?

Jitheesh added a commit to Jitheesh/magento2-module-disabletwofactorauth that referenced this issue Nov 10, 2020
@markshust
Copy link
Owner

Just left a comment on the commit that just came in a few hours ago. Once I can test this and verify code is working, I can bring this in.

@simonmaass
Copy link

We are having the same issue. Any update on this?

@markshust
Copy link
Owner

Hi @simonmaass -- this is my first day back from a little break. I'll be spending the next couple weeks on open source stuff, so will be testing this out and merging it in shortly (hopefully within the next few hours).

@markshust
Copy link
Owner

Issue confirmed on 2.4.1. Testing out PR/commit.

@markshust markshust linked a pull request Jan 12, 2021 that will close this issue
markshust added a commit that referenced this issue Jan 12, 2021
@markshust
Copy link
Owner

Merged this PR, and also made some styling/coding updates on the other files to keep things consistent with the coding recommendations I made. Tagged as version 1.1.0.

@simonmaass
Copy link

@markshust thank you for the fast implementation!

@simonmaass
Copy link

@markshust If I try to enable it for the API i get the following error:

image

@royduin
Copy link

royduin commented Jul 12, 2022

Got the same error, but just putting twofactorauth/general/enable_for_api_token_generation with value 0 into core_config_data seems to work.

@markshust
Copy link
Owner

Thanks for this report & info @royduin -- I'll re-open this ticket so we can fix this.

@markshust markshust reopened this Jul 19, 2022
@markshust
Copy link
Owner

Whoah - this ticket has been sitting here for a while 😅

I really don't want to disable 2FA for API token generation by default, as I think it should be retained enabled for security purposes.

But it appears this error is occurring only when "Enable 2FA" is set to No, and "Enable 2FA for API Token Generation" is set to Yes. Is this correct?

If so, what do you think would be the best way to handle this situation?

@CalamityJames
Copy link

But it appears this error is occurring only when "Enable 2FA" is set to No, and "Enable 2FA for API Token Generation" is set to Yes. Is this correct?

This is indeed what happens, for anyone who wants to work around it for the time being, you can do it via the CLI:

bin/magento config:set twofactorauth/general/enable_for_api_token_generation 0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants