New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

jwt-jot

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

jwt-jot

A javascript JWT helper

1.2.3
latest
Source
npm
Version published
Weekly downloads
0
-100%
Maintainers
1
Weekly downloads
 
Created
Source

jwt-jot

A simple javascript JWT helper Object

  • For browsers: Integrated with localStorage for easy persisted token management

Build Status npm version

Browser Object

Import library
import { Browser as JotBrowser } from 'jwt-jot'
Create new instance
let key = 'id_token'
let token = myJWTFromSomewhere()

// * Option 1: with <key, token> arguments
// Will save token to window.localStorage at specified key
let jot = new JotBrowser(key, token)

// * Option 2: with <key> argument
// Will get token from localStorage if it exists
let jot = new JotBrowser(key)
Instance method - valid()
jot.valid() // --> bool
Instance method - getClaim()
let claimKey = 'role' // <-- specify property name in token payload

jot.getClaim(claimKey) // --> token payload['role'] or undefined
Instance method - getToken()
jot.getToken() // --> JWT or null
Instance method - eject()
jot.eject() // removes token from localStorage

Keywords

jwt

FAQs

Package last updated on 20 Mar 2016

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