Introducing Socket Firewall: Free, Proactive Protection for Your Software Supply Chain.Learn More →
Socket
Book a DemoInstallSign in
Socket

@jill64/cognito-passwordless

Package Overview
Dependencies
Maintainers
1
Versions
234
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@jill64/cognito-passwordless

🔑 Passwordless authentication for AWS Cognito

latest
Source
npmnpm
Version
0.0.237
Version published
Weekly downloads
40
3900%
Maintainers
1
Weekly downloads
 
Created
Source

Installation

npm i cognito-passwordless

Usage

Frontend

import { CognitoPasswordless } from 'cognito-passwordless';

const client = new CognitoPasswordlessClient(
    // AWS Credential
    {
      accessKeyId: string
      secretAccessKey: string
      region: string
    },
    // Cognito Credential
    {
      clientId: string
      clientSecret: string
      userPoolId: string
    },
    // Cookies Handler
    {
      set: (
        name: string,
        value: string,
        options?: CookieSerializeOptions
      ) => void
      delete: (name: string, options?: CookieSerializeOptions) => void
      get: (name: string) => string | undefined
    })

// Authenticate
const userInfo = await client.auth()

// Signup
const email = 'email@example.com'
const session = await client.signup(email)
await login({
  session,
  email,
  code: 'OTP-CODE'
})

// Login
const email = 'email@example.com'
const session = await client.sendEmail(email)
await login({
  session,
  email,
  code: 'OTP-CODE'
})

// Logout
await client.logout()

Backend

Please deploy these Lambda functions properly.

import { CognitoPasswordlessServer } from 'cognito-passwordless';

const server = new CognitoPasswordlessServer(
  region: string,
  // Verify Mail
  {
    source: string
    subject: string
    body: (code: string) => string
  }
)

// Define Challenge Lambda Function
export const handle = server.defineChallenge

// Create Challenge Lambda Function
export const handle = server.createChallenge

// Verify Challenge Lambda Function
export const handle = server.verifyChallenge

Keywords

aws

FAQs

Package last updated on 16 Jun 2025

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts