Skip to content

This is an implementation of the @okta/jwt-verifier used in express.js middleware.

License

Notifications You must be signed in to change notification settings

polarpop/express-middleware-jwt-verifier

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

express-middleware-okta-jwt

Node.js Express Middleware to verify OKTA jwt tokens

Installation

You can install express-middleware-okta-jwt by either yarn or NPM.

npm

npm install express-middleware-okta-jwt

yarn

yarn add express-middleware-okta-jwt

Usage

This middleware is strictly for express. You can utilize as a global middleware in your express instance, or in a route.

const express = require('express');
const jwtVerifier = require('express-middleware-okta-jwt');

const app = express();

// Global middleware
app.use(jwtVerifier({ issuer: 'https://example.okta.com/oauth2/default' }));

// route middleware

const router = new express.Router();

router.get('/', (req, res, next) => {
	res.send('I am a public route');
});

router.get('/verified', jwtVerifier({ issuer: 'https://example.okta.com/oauth2/default' }), (req, res, next) => {
	res.send(`I am a verified route. Context: ${req.jwt}`);
})

API

If you need more flexibility see the API Docs

About

This is an implementation of the @okta/jwt-verifier used in express.js middleware.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published