Search by

marko / authentication-two-factor

markshust

Two-factor authentication (TOTP and recovery codes) for Marko Framework

Package info

github.com/marko-php/marko-authentication-two-factor

Type:marko-module

pkg:composer/marko/authentication-two-factor

Statistics

Installs: 0

Dependents: 0

Suggesters: 0

Stars: 0

0.13.0 2026-11-03 18:25 UTC

This package is auto-updated.

Last update: 2026-11-03 19:15:39 UTC


README

Two-factor authentication for Marko --- TOTP codes from any authenticator app, single-use recovery codes, and a login challenge that holds password logins until the code is entered.

Installation

composer require marko/authentication-two-factor

Quick Example

use Marko\AuthenticationTwoFactor\Contracts\TwoFactorManagerInterface;
use Marko\AuthenticationTwoFactor\TwoFactorChallenge;

// Setup: show the QR code (otpauth URI) and recovery codes once
$setup = $twoFactorManager->enable($user, label: $user->email);
$twoFactorManager->confirm($user, $codeFromApp);

// Login: with TwoFactorLoginChallenge on the guard, attempt() holds the user
if (!$authManager->attempt($credentials) && $twoFactorChallenge->isPending()) {
    // ...show the code form, then:
    $twoFactorChallenge->verify($submittedCode);
}

Documentation

Full usage, API reference, and examples: marko/authentication-two-factor