{"url":"https://github.com/auth0/jwt-decode/issues","bugs":{"url":"https://github.com/auth0/jwt-decode/issues"},"dist":{"shasum":"477207d00ffc3409592619a22c6f4daab16030dd","tarball":"https://registry.npmjs.org/jwt-decode/-/jwt-decode-4.0.0-beta.4.tgz","fileCount":8,"integrity":"sha512-h7Fh3yXkngAKRgo8AN0Jh9SGyIQWVyOUZ/yi85f8515bNua54ftRgdXgAVA5Z8y8Es7BFIVtx0PcuvbvzZN5GA==","signatures":[{"sig":"MEUCIQDgGwxMh0WtDH7W/hhmH+rw5llccY2108eQkaUleUy9LAIgcF/lFebmzQplrqFmSL5DGXpEd6X1SeCYF9hoY6Sz8kc=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":13945},"main":"build/cjs/index.js","name":"jwt-decode","type":"module","types":"build/cjs/index.d.ts","author":{"name":"Jose F. Romaniello","email":"jfromaniello@gmail.com"},"module":"build/esm/index.js","readme":"![Browser library that helps decoding JWT tokens which are Base64Url encoded](https://cdn.auth0.com/website/sdks/banners/jwt-decode-banner.png)\n\n**IMPORTANT:** This library doesn't validate the token, any well-formed JWT can be decoded. You should validate the token in your server-side logic by using something like [express-jwt](https://github.com/auth0/express-jwt), [koa-jwt](https://github.com/stiang/koa-jwt), [Microsoft.AspNetCore.Authentication.JwtBearer](https://www.nuget.org/packages/Microsoft.AspNetCore.Authentication.JwtBearer), etc.\n\n![Release](https://img.shields.io/npm/v/jwt-decode)\n![Downloads](https://img.shields.io/npm/dw/jwt-decode)\n[![License](https://img.shields.io/:license-MIT-blue.svg?style=flat)](https://opensource.org/licenses/MIT)\n[![CircleCI](https://img.shields.io/circleci/build/github/auth0/jwt-decode)](https://circleci.com/gh/auth0/jwt-decode)\n\n:books: [Documentation](#documentation) - :rocket: [Getting Started](#getting-started) - :speech_balloon: [Feedback](#feedback)\n\n## Documentation\n\n- [Docs site](https://www.auth0.com/docs) - explore our docs site and learn more about Auth0.\n\n## Getting started\n\n### Installation\n\nInstall with NPM or Yarn.\n\nRun `npm install jwt-decode` or `yarn add jwt-decode` to install the library.\n\n### Usage\n\n```js\nimport { jwtDecode } from \"jwt-decode\";\n\nconst token = \"eyJ0eXAiO.../// jwt token\";\nconst decoded = jwtDecode(token);\n\nconsole.log(decoded);\n\n/* prints:\n * { \n *   foo: \"bar\",\n *   exp: 1393286893,\n *   iat: 1393268893  \n * }\n */\n\n// decode header by passing in options (useful for when you need `kid` to verify a JWT):\nconst decodedHeader = jwtDecode(token, { header: true });\nconsole.log(decodedHeader);\n\n/* prints:\n * { \n *   typ: \"JWT\",\n *   alg: \"HS256\" \n * }\n */\n```\n\n**Note:** A falsy or malformed token will throw an `InvalidTokenError` error; see below for more information on specific errors.\n\n## Errors\n\nThis library works with valid JSON web tokens. The basic format of these token is\n```\n[part1].[part2].[part3]\n```\nAll parts are supposed to be valid base64 (url) encoded json.\nDepending on the `{ header: <option> }` option it will decode part 1 (only if header: true is specified) or part 2 (default)\n\nNot adhering to the format will result in a `InvalidTokenError` with one of the following messages:\n\n- `Invalid token specified: must be a string` => the token passed was not a string, this library only works on strings. \n- `Invalid token specified: missing part #` => this probably means you are missing a dot (`.`) in the token \n- `Invalid token specified: invalid base64 for part #` => the part could not be base64 decoded (the message should contain the error the base64 decoder gave)\n- `Invalid token specified: invalid json for part #` => the part was correctly base64 decoded, however, the decoded value was not valid JSON (the message should contain the error the JSON parser gave)\n\n#### Use with TypeScript\n\nThe return type of the `jwtDecode` function is determined by the `header` property of the object passed as the second argument. If omitted (or set to false), it'll use `JwtPayload`, when true it will use `JwtHeader`. \nIf needed, you can specify what the expected return type should be by passing a type argument to the `jwtDecode` function.\n\nYou can extend both `JwtHeader` and `JwtPayload` to include non-standard claims or properties.\n\n```typescript\nimport { jwtDecode } from \"jwt-decode\";\n\nconst token = \"eyJhsw5c\";\nconst decoded = jwtDecode<JwtPayload>(token); // Returns with the JwtPayload type\n```\n\n#### Use as a CommonJS package\n\n```javascript\nconst { jwtDecode } = require('jwt-decode');\n...\n```\n\n#### Include with a script tag\n\nCopy the file `jwt-decode.js` from the root of the `build/esm` folder to your project somewhere, then import `jwtDecode` from it inside a script tag that's marked with `type=\"module\"`:\n\n```html\n<script type=\"module\">\n  import { jwtDecode } from \"/path/to/jwt-decode.js\";\n\n  const token = \"eyJhsw5c\";\n  const decoded = jwtDecode(token);\n</script>\n```\n\n## Feedback\n\n### Contributing\n\nWe appreciate feedback and contribution to this repo! Before you get started, please see the following:\n\n- [Auth0's general contribution guidelines](https://github.com/auth0/open-source-template/blob/master/GENERAL-CONTRIBUTING.md)\n- [Auth0's code of conduct guidelines](https://github.com/auth0/open-source-template/blob/master/CODE-OF-CONDUCT.md)\n\n### Raise an issue\n\nTo provide feedback or report a bug, please [raise an issue on our issue tracker](https://github.com/auth0/jwt-decode/issues).\n\n### Vulnerability Reporting\n\nPlease do not report security vulnerabilities on the public GitHub issue tracker. The [Responsible Disclosure Program](https://auth0.com/responsible-disclosure-policy) details the procedure for disclosing security issues.\n\n---\n\n<p align=\"center\">\n  <picture>\n    <source media=\"(prefers-color-scheme: light)\" srcset=\"https://cdn.auth0.com/website/sdks/logos/auth0_light_mode.png\"   width=\"150\">\n    <source media=\"(prefers-color-scheme: dark)\" srcset=\"https://cdn.auth0.com/website/sdks/logos/auth0_dark_mode.png\" width=\"150\">\n    <img alt=\"Auth0 Logo\" src=\"https://cdn.auth0.com/website/sdks/logos/auth0_light_mode.png\" width=\"150\">\n  </picture>\n</p>\n<p align=\"center\">Auth0 is an easy to implement, adaptable authentication and authorization platform. To learn more checkout <a href=\"https://auth0.com/why-auth0\">Why Auth0?</a></p>\n<p align=\"center\">\nThis project is licensed under the MIT license. See the <a href=\"./LICENSE\"> LICENSE</a> file for more info.</p>\n","engines":{"node":">=18"},"exports":{".":{"import":{"types":"./build/esm/index.d.ts","default":"./build/esm/index.js"},"require":{"types":"./build/cjs/index.d.ts","default":"./build/cjs/index.js"}}},"gitHead":"335ba5ca4839090d220490cfa7df4db8a774ab53","license":"MIT","scripts":{"dev":"concurrently --kill-others \"npm run build:watch\" \"npm run dev:server\"","lint":"eslint .","test":"npm run test:node && npm run test:browser","build":"tsc -b ./tsconfig.cjs.json ./tsconfig.esm.json","prepack":"npm run build","prepare":"husky install","prebuild":"shx rm -rf ./build && shx mkdir -p ./build/cjs && shx echo '{\"type\": \"commonjs\"}'> build/cjs/package.json","test:node":"NODE_OPTIONS='--experimental-vm-modules --no-warnings' jest --coverage","dev:server":"browser-sync start --config bs-config.json","build:watch":"npm run build -- --watch","lint:package":"publint","test:browser":"NODE_OPTIONS='--experimental-vm-modules --no-warnings' jest --coverage --testEnvironment=jsdom"},"_npmUser":{"name":"auth0-oss","email":"oss.sdks@auth0.com"},"homepage":"https://github.com/auth0/jwt-decode#readme","keywords":["jwt","browser"],"repository":{"url":"git://github.com/auth0/jwt-decode.git","type":"git"},"_npmVersion":"7.19.1","description":"Decode JWT tokens, mostly useful for browser applications.","directories":{},"lint-staged":{"*.{js,ts}":"eslint --fix"},"maintainers":[{"name":"vic-dev","email":"vmichellej@gmail.com"},{"name":"enriquepina","email":"enrique.pina@auth0.com"},{"name":"ece-okta","email":"ece.tavasli@auth0.com"},{"name":"pubalokta","email":"pablo.ubal@okta.com"},{"name":"dougmiller-okta","email":"douglas.miller@auth0.com"},{"name":"zak.nour","email":"zak.nour@auth0.com"},{"name":"stheller","email":"stefan.heller@auth0.com"},{"name":"jamescgarrett-okta","email":"james.garrett@auth0.com"},{"name":"madhuri.rm23","email":"madhuri.ravindramohan@okta.com"},{"name":"willvedd","email":"willvedd@gmail.com"},{"name":"david.renaud.okta","email":"david.renaud@okta.com"},{"name":"jeff.shuman","email":"jeff.shuman@auth0.com"},{"name":"auth0-oss","email":"oss.sdks@auth0.com"},{"name":"codepete","email":"peter.ung@auth0.com"},{"name":"ziluvatar","email":"eduardo.diaz@okta.com"},{"name":"iaco","email":"sebastian.iacomuzzi@gmail.com"},{"name":"cocojoe","email":"martin.walsh@gmail.com"},{"name":"auth0npm","email":"devops+npm@auth0.com"},{"name":"auth0brokkr","email":"support@auth0.com"},{"name":"hzalaz","email":"hernan@auth0.com"},{"name":"aaguiarz","email":"andres.aguiar@gmail.com"},{"name":"charlesrea","email":"charles.rea@auth0.com"},{"name":"lbalmaceda","email":"balmacedaluciano@gmail.com"},{"name":"julien.wollscheid","email":"julien.wollscheid@auth0.com"},{"name":"cristiandouce","email":"cristiandouce@gmail.com"},{"name":"sambego","email":"sambellen@gmail.com"},{"name":"stevehobbsdev","email":"steve.hobbs@auth0.com"},{"name":"sandrinodimattia","email":"sandrino@dimattia.be"},{"name":"lzychowski","email":"les.zychowski@auth0.com"},{"name":"joshcanhelp","email":"josh@joshcanhelp.com"},{"name":"rob.coles","email":"rob.coles@auth0.com"},{"name":"rosnovsky","email":"artem@rosnovsky.us"},{"name":"davidpatrick0","email":"david.patrick@auth0.com"},{"name":"widcket","email":"zeta@widcket.com"},{"name":"adamjmcgrath","email":"adamjmcgrath@gmail.com"},{"name":"jim.andersoon","email":"jim.anderson@auth0.com"},{"name":"frederikprijck","email":"frederik.prijck@gmail.com"},{"name":"sergii.biienko","email":"sergii.biienko@auth0.com"},{"name":"tomauth0","email":"tom.carter@auth0.com"},{"name":"jpadilla","email":"hello@jpadilla.com"},{"name":"jessele","email":"jesse.le@auth0.com"},{"name":"rhamzeh_auth0","email":"raghd.hamzeh@auth0.com"},{"name":"greglopez","email":"greg.lopez@auth0.com"},{"name":"jfromaniello","email":"jfromaniello@gmail.com"},{"name":"heyitsry","email":"ryan.wilke@auth0.com"}],"_nodeVersion":"16.6.0","contributors":[{"name":"Sam Bellen","email":"sam.bellen@auth0.com"}],"_hasShrinkwrap":false,"readmeFilename":"README.md","devDependencies":{"shx":"^0.3.4","jest":"^29.6.2","husky":"^8.0.3","eslint":"^8.48.0","publint":"^0.2.2","ts-jest":"^29.1.1","ts-node":"^10.9.1","prettier":"^3.0.2","jest-junit":"^16.0.0","typescript":"^5.1.6","lint-staged":"^14.0.1","browser-sync":"^2.29.3","concurrently":"^8.2.0","eslint-plugin-import":"^2.28.1","eslint-config-prettier":"^9.0.0","eslint-plugin-prettier":"^5.0.0","jest-environment-jsdom":"^29.6.2","@typescript-eslint/parser":"^6.4.1","@typescript-eslint/eslint-plugin":"^6.4.1","eslint-import-resolver-typescript":"^3.6.0"},"_npmOperationalInternal":{"tmp":"tmp/jwt-decode_4.0.0-beta.4_1693906889569_0.6206122710189517","host":"s3://npm-registry-packages"},"_id":"jwt-decode@4.0.0-beta.4","version":"4.0.0-beta.4"}