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

jwt-mock-server

Package Overview
Dependencies
Maintainers
0
Versions
10
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

jwt-mock-server

Start a mock jwt authentication server for local development

  • 0.0.10
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
44
increased by76%
Maintainers
0
Weekly downloads
 
Created
Source

A JWT mock server for local development

Run in local

npm install
npm run start
## OR
npm run start -- --claims '{"username": "test@test.com", "userId": 1, "authorities": ["AUTH_1"]}'  --token-expiry 3600

Run with npx

default port 9000

npx --package jwt-mock-server start

to run in a different port 3000

PORT=3000 npx --package jwt-mock-server start

endpoints

curl --location --request GET 'localhost:9000/jwt/.well-known/jwks.json'

get a jwt token and pass claims in post body

curl --location --request POST 'localhost:9000/jwt/token' \
--header 'Content-Type: application/json' \
--data-raw '{"username": "user1@test.com"}'

get a jwt using get and pass claims in query params:

curl --location --request GET 'localhost:9000/jwt/token?username=abc@test.com.au&authorities=AUTH_WP&authorities=AUTH_WP2' \
--header 'Content-Type: application/json'

or you can get the default claims, the default claims needs to be passed when you start the server

npx --package github:ruiyang/jwt-mock-server start --claims '{"username": "test-user@test.com"}'

curl --location --request GET 'localhost:9000/jwt/token' \
--header 'Content-Type: application/json'

shutdown the server gracefully

curl --location --request GET 'localhost:9000/shutdown'

Keywords

FAQs

Package last updated on 19 Dec 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