Multi Factor Authentication with YII2-mfa plugin

Yes. I know this. But the problem is, that the $event->cookieBased is false. The secretKey and $this->owner_enableSession are not empty or false.

So the script will set the $event->isValid to false. And so the application will not login the user.

If i change the script and set the $event->isValid to true, the application logged in the user.

    public function beforeLogin(UserEvent $event)
        if (!$event->isValid) {

        if (!$event->identity instanceof IdentityInterface) {
            throw new InvalidValueException("{$this->owner->identityClass}::findIdentity() must return an object implementing \\vxm\\mfa\\IdentityInterface.");

        $secretKey = $event->identity->getMfaSecretKey();

        if (!empty($secretKey) && $this->owner->enableSession && !$event->cookieBased) {
            $event->isValid = true;
            $this->saveIdentityLoggedIn($event->identity, $event->duration);

But then i have another error with the QrCodeWidget.

I look now at this error and hope that i will found a solution.

Now i use

This works fine.

1 Like

Glad you solved it.
Checked extension it was last updated in 2018.
You might want to use updated fork (March, 2022)