Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@okta/jwt-verifier

Package Overview
Dependencies
Maintainers
1
Versions
24
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@okta/jwt-verifier

Easily validate Okta access tokens

  • 4.0.1
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created

What is @okta/jwt-verifier?

@okta/jwt-verifier is an npm package that provides functionality to verify JSON Web Tokens (JWTs) issued by Okta. It is commonly used in applications to ensure that the tokens being used for authentication and authorization are valid and have not been tampered with.

What are @okta/jwt-verifier's main functionalities?

Verify JWT

This feature allows you to verify the validity of a JWT issued by Okta. The code sample demonstrates how to create an instance of OktaJwtVerifier and use it to verify a JWT.

const OktaJwtVerifier = require('@okta/jwt-verifier');

const oktaJwtVerifier = new OktaJwtVerifier({
  issuer: 'https://{yourOktaDomain}/oauth2/default',
  clientId: '{clientId}'
});

async function verifyToken(token) {
  try {
    const jwt = await oktaJwtVerifier.verifyAccessToken(token, 'api://default');
    console.log('Token is valid:', jwt);
  } catch (err) {
    console.log('Token is invalid:', err);
  }
}

verifyToken('your-jwt-token');

Custom Claims Verification

This feature allows you to verify a JWT with custom claims. The code sample demonstrates how to verify a JWT with specific audience and issuer claims.

const OktaJwtVerifier = require('@okta/jwt-verifier');

const oktaJwtVerifier = new OktaJwtVerifier({
  issuer: 'https://{yourOktaDomain}/oauth2/default',
  clientId: '{clientId}'
});

async function verifyTokenWithClaims(token) {
  try {
    const jwt = await oktaJwtVerifier.verifyAccessToken(token, 'api://default', {
      audience: 'api://default',
      issuer: 'https://{yourOktaDomain}/oauth2/default'
    });
    console.log('Token is valid with claims:', jwt);
  } catch (err) {
    console.log('Token is invalid:', err);
  }
}

verifyTokenWithClaims('your-jwt-token');

Other packages similar to @okta/jwt-verifier

Keywords

FAQs

Package last updated on 27 Aug 2024

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc