Registry / security / fintegrate-auth

fintegrate-auth

JSON →
library1.0.132jsnpmunverified

The Auth package for Fintegrate ecosystem (v1.0.132, actively maintained, frequent releases) provides JWT-based authentication tools for NestJS applications. It integrates Passport strategies (JWT, local) with JWKS support via jwks-rsa. Key differentiators: pre-configured guards and decorators for Fintegrate microservices, automatic token refresh and validation against a JWKS endpoint. Compared to @nestjs/jwt+passport, it adds opinionated defaults for Fintegrate's API gateway pattern.

npm install fintegrate-auth
INSTALL
IMPORT
SIG · FINTEGRATE-AUTH
F
fintegrate-auth
securityjavascriptv1.0.132
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

AuthModule
import { AuthModule } from 'fintegrate-auth';
import AuthModule from 'fintegrate-auth';
Named export, not default. ESM/CJS compatible.
JwtAuthGuard
import { JwtAuthGuard } from 'fintegrate-auth';
const JwtAuthGuard = require('fintegrate-auth');
Named export. Wrong: require returns module object, not the guard class directly.
CurrentUser
import { CurrentUser } from 'fintegrate-auth';
import { CurrentUser } from '@nestjs/common';
Custom decorator, not from NestJS common. Typed with Fintegrate user interface.
AuthService
import { AuthService } from 'fintegrate-auth';
import { AuthService } from './auth/auth.service';
Service is re-exported from the package; do not import from internal paths.

Shows registration of AuthModule with JWKS URI and usage of JwtAuthGuard and CurrentUser decorator in a NestJS controller.

// app.module.ts import { Module } from '@nestjs/common'; import { AuthModule } from 'fintegrate-auth'; @Module({ imports: [ AuthModule.register({ jwksUri: process.env.JWKS_URI ?? 'https://example.com/.well-known/jwks.json', audience: process.env.AUDIENCE ?? 'my-api', issuer: process.env.ISSUER ?? 'https://example.com/', }), ], }) export class AppModule {} // protected.controller.ts import { Controller, Get, UseGuards } from '@nestjs/common'; import { JwtAuthGuard, CurrentUser } from 'fintegrate-auth'; @Controller('protected') export class ProtectedController { @UseGuards(JwtAuthGuard) @Get('profile') getProfile(@CurrentUser() user: any) { return user; } }
Debug
Known issues
deprecatedThe 'AuthModule.forRoot()' static method is deprecated, use 'AuthModule.register()' instead.
fix
Replace 'AuthModule.forRoot({...})' with 'AuthModule.register({...})'.
affects: <=1.0.100
breakingIn v1.0.0, the 'CurrentUser' parameter decorator returns the entire JWT payload; previously returned only the sub claim.
fix
If you relied on sub-only, change your controller to destructure the user object: 'getProfile(@CurrentUser() { sub }: any)'.
affects: >=1.0.0 <1.0.50
gotchaIf you do not configure 'jwksUri', the module throws at runtime: 'JWKS URI is required'. It is not optional.
fix
Always provide 'jwksUri' in the configuration object passed to 'AuthModule.register()'.
affects: >=1.0.0
deprecatedThe 'AuthGuard' export (formerly 'AuthGuard') is deprecated, use 'JwtAuthGuard' instead.
fix
Import 'JwtAuthGuard' instead of 'AuthGuard'.
affects: >=1.0.0 <=1.0.99
gotchaPassing a string audience to 'register()' instead of a string array will cause mismatch if JWT contains audience as array.
fix
Always pass audience as an array: audience: ['my-api'].
affects: >=1.0.0
Errors
Common errors & fixes
Error: JWKS URI is required
Missing or undefined jwksUri in AuthModule.register() configuration.
fix
Provide jwksUri in the config object, e.g., AuthModule.register({ jwksUri: '...' }).
Cannot read properties of undefined (reading 'sub')
The CurrentUser decorator returned undefined because the guard is not applied or the token is invalid.
fix
Ensure @UseGuards(JwtAuthGuard) is applied to the route and the JWT is valid.
Error: audience mismatch
The JWT's audience claim does not match the configured audience in AuthModule.
fix
Check that the JWT contains the expected audience and that the audience config matches exactly (string for single, array for multiple).
TypeError: Passport.authenticate is not a function
Missing Passport installation or incorrect import order.
fix
Ensure passport and @nestjs/passport are installed and that PassportModule is imported before AuthModule.
Upgrade
Version history
1.0.132latest on npm
Audit
Dependencies
jwks-rsarequiredRS256 JWT verification against JWKS endpoint
passportrequiredCore Passport authentication framework
passport-jwtrequiredJWT strategy for Passport
@nestjs/corerequiredNestJS core module, required for guards and decorators
@nestjs/commonrequiredNestJS common utilities
@nestjs/passportrequiredPassport integration for NestJS
Agent activity
18 hits · last 30 days
node
16
Amazon
1
OpenAI (training)
1
Resources
fintegrate-auth — npm install fintegrate-auth · libregistry