Вышел Модуль интеграций 2.0 для MedusaЧитать анонс
Passwordless logo

Passwordless

Добавьте беспарольный вход по SMS

npm install @devx-commerce/passwordless
Категория
Создано
Версия
12.0.0-beta.0
Последнее обновление
6 месяцев назад
Ежемесячные загрузки
Загрузка данных

Medusa logo

Medusa Plugin - Passwordless Authentication

Documentation | Website

A plugin for implementing passwordless authentication in Medusa

PRs welcome! Product Hunt Discord Chat Follow @medusajs

Features

  • 🔐 Phone number based authentication
  • 🔢 Secure verification code generation and validation
  • ⏱️ Rate limiting with maximum attempt controls
  • ⏳ Code expiration management
  • 🔌 Easy integration with existing Medusa stores

This plugin requires:

Installation

  1. Install the plugin:
  1. Add the plugin to your :

Configuration Options

Security Settings

  • : Length of verification code (default: 4)
  • : Code expiration time in minutes (default: 3)
  • : Maximum verification attempts (default: 3)
  • : Time between SMS requests in minutes (default: 10)
  • : Block duration after max attempts in minutes (default: 5)

How It Works

  1. Authentication Flow:

    • User provides phone number
    • System generates a secure verification code
    • User enters the code to complete authentication
  2. Security Features:

    • Rate limiting prevents abuse
    • Maximum attempt controls
    • Code expiration
    • Secure code generation

Usage

The plugin provides two main endpoints:

  1. Authentication Request
  1. Verification

Phone Number Format

Phone numbers must be in E.164 format:

  • Starts with '+'
  • Country code
  • National number
  • Example: +1234567890

Error Handling

The plugin provides clear error messages for various scenarios:

  • Invalid phone number format
  • Rate limit exceeded
  • Maximum attempts exceeded
  • Invalid or expired code
  • Provider-specific errors