npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2025 – Pkg Stats / Ryan Hefner

@nicogorga/medusa-auth-emailpass-verified

v0.0.3

Published

A Medusa auth provider plugin to authenticate users with email and password, adding email verification for security

Readme

A plugin for implementing authentication with email and password, with added security through email verification.

Compatibility

This starter is compatible with versions >= 2.10.3 of @medusajs/medusa. Lower version were not tested

Pre requisites

  • Email Notification Module installed in your Medusa application as the verification code will be sent via email. You can check existent plugins here
  • Subscriber listening to the EmailPassVerifiedEvents.CODE_GENERATED event to send the email verification. Example implementation:
// src/subscribers/auth-send-verification-email.ts

import { SubscriberArgs, SubscriberConfig } from "@medusajs/framework";
import { CodeGeneratedEventData, EmailPassVerifiedEvents } from "@nicogorga/medusa-auth-emailpass-verified/providers/emailpass-verified/types";
import { Modules } from "@medusajs/framework/utils";

export default async function({ container, event }: SubscriberArgs<CodeGeneratedEventData>) {
    const notificationService = container.resolve(Modules.NOTIFICATION)
    const { email, code, callbackUrl } = event.data

    await notificationService.createNotifications({
        to: email,
        channel: 'email',
        template: 'verification-code',
        content: {
            subject: 'Account Verification',
            html: `
                <h1>Verify your account</h1>
                <p>Please verify your email address by clicking the link below:</p>
                <p>
                    <a href="${callbackUrl}?email=${encodeURIComponent(email)}&code=${code}"
                       style="background-color: #4CAF50; color: white; padding: 14px 20px; text-align: center; text-decoration: none; display: inline-block; border-radius: 4px;">
                        Verify Email
                    </a>
                </p>
                <p>If you didn't request this verification, please ignore this email.</p>
            `
        }
    })
}

export const config: SubscriberConfig = {
    event: EmailPassVerifiedEvents.CODE_GENERATED,
    context: {
        subscriberId: 'emailpass-verified-verification-code-sender'
    }
}

Installation

  1. Install the plugin
yarn add @nicogorga/medusa-auth-emailpass-verified
# or
npm install @nicogorga/medusa-auth-emailpass-verified
  1. Add the plugin to your medusa-config.ts:
{
  // ... other configs
  modules: [
    // ... other modules
    {
      resolve: "@medusajs/medusa/auth",
      dependencies: [Modules.CACHE, ContainerRegistrationKeys.LOGGER],
      options: {
        providers: [
          // ... other auth providers
          {
            resolve: "@nicogorga/medusa-auth-emailpass-verified/providers/emailpass-verified",
            id: "emailpass-verified",
          }
        ]
      }
    },
  ]
}

Usage

ℹ️ If you want to see an example of an auth flow implementation for this plugin, you can check the following repository, which showcases authenticating customers in the NextJS starter

  1. Call the authentication route
POST /auth/customer/emailpass-verified
{
  "email": "[email protected]",
  "password": "supersecret",
  "callback_url": "localhost:8000/auth/emailpass-verified/customer"
}
  1. An email will be sent to the address matching the email from the previous point. When the user clicks on the link received in the email, they should be redirected to callback_url?email=email&code=code

  2. Call the validate callback route from the callback_url passing the query parameters as they are.

POST /auth/customer/emailpass-verified/callback?email=email&code=code
  1. With the received token, call the relevant endpoint to create the corresponding entity, like the Customer.