🚀 DAY 4 OF LAUNCH WEEK:Introducing Socket Scanning for OpenVSX Extensions.Learn more →
Socket
Book a DemoInstallSign in
Socket

@byu-oit/fastify-jwt

Package Overview
Dependencies
Maintainers
0
Versions
22
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@byu-oit/fastify-jwt

A Fastify plugin for verifying callers JWTs with the BYU JWT package

latest
Source
npmnpm
Version
0.2.1
Version published
Weekly downloads
22
83.33%
Maintainers
0
Weekly downloads
 
Created
Source

@byu-oit/fastify-jwt

Provides a fastify plugin for verifying JWTs at BYU OIT

Usage

import Fastify from 'fastify'
import { ByuLogger } from '@byu-oit/logger'
import { ByuJwtProvider } from '@byu-oit/fastify-jwt'

const logger = ByuLogger()
const fastify = Fastify({ logger })

fastify.register(ByuJwtProvider, {
  /** Only authenticate routes matching this prefix */
  prefix: '/example/v1', 
  development: process.env.NODE_ENV === 'development',
  /** May pass in ByuJwt options from @byu-oit/jwt */
  issuer: 'https://api.byu.edu', 
  additionalValidations: [(jwt) => {
    if(false) throw new Error('This will never happen')
  }]
})

await fastify.listen({ port: 3000 }).catch(console.error)

Options

In addition to the three properties below, you can also pass in any options that are defined in BYU JWT documentation as well.

propertytypedefaultdescription
prefixstringundefinedWill only authenticate routes matching this prefix.
developmentbooleanfalseskips JWT verification for development purposes but will throw an error if NODE_ENV is set to production.
basePathstringundefinedwill validate that the audience starts with the provided basePath in production.

FAQs

Package last updated on 28 Jul 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