Drupal is a registered trademark of Dries Buytaert

otp_service

2 sites No security coverage
View on drupal.org

Description

The OTP Service (otp_service) module provides a simple way to add OTP (One-Time Password) functionality to your application. This module provides a block that allows users to setup their secret using the scan of a QR Code and their preferred application (Google Authenticator, Microsoft Authenticator etc... ).
The secret is stored as a field in the user entity to be later retrieved for validation (this data IS NOT encrypted).
The module also allows to protect the access to a bundle by its service
The module also provides a service to validate user input OTP's in your application.
This way you can focus on your app functionality without worrying about OTP implementation.

Use Case

There is some page or functionality that you want to "protect".
Users log in using their password and email/username, no two factor authentication required.
When they access a certain page/feature, they have to provide a OTP to access it.

With this module you can provide a block to users so they can setup their secret with their preferred app.
You can then implement a custom form to collect the code their app provided and on submit of the input call the service this module provides to validation. You can then use the result of the validation (true/false) to manage the access to the page/feature.

Requirements

This module uses the pragmarx/google2fa package to generate secrets and validate OTP's.
The package will be automatically pulled via composer.

Installation

Install as you would normally install a contributed Drupal module. Visit https://www.drupal.org/docs/8/extending-drupal-8/installing-drupal-8-mod... for further information.

Configuration

  • The module provides a block for the users to setup their OTP secret. Use Block Layout or another way to render the block where you want it.
  • The module provides a service to validate user input OTP's that you can use anywhere in your application.

Activity

Total releases
2
First release
Jan 2025
Latest release
1 year ago
Release cadence
0 days
Stability
50% stable

Releases

Version Type Release date
2.0.0 Stable Jan 19, 2025
2.0.x-dev Dev Jan 19, 2025