{"_id":"@aquacloud/axios-jwt","_rev":"8-9f65f72ce9ae4f2bc36628b181f72b34","name":"@aquacloud/axios-jwt","dist-tags":{"latest":"0.0.3","alpha":"0.0.3-alpha.6"},"versions":{"0.0.1":{"name":"@aquacloud/axios-jwt","version":"0.0.1","description":"Handle rotating tokens without pain","main":"build/index.js","types":"build/index.d.ts","license":"MIT","author":{"name":"Federico Vitale","email":"federico.vitale@aquacloud.it"},"keywords":["api","jwt","auth","refresh","axios"],"contributors":[],"scripts":{"coverage":"vitest run -c ./config/vitest.config.ts --coverage","test":"vitest -c ./config/vitest.config.ts","build":"tsup src --config ./config/tsup.config.ts","lint-fix":"eslint src/**/*.ts --fix","lint":"eslint src/**/*.ts","dev":"tsup src --watch --config ./config/tsup.config.ts"},"exports":{".":{"default":"./build/index.js","import":"./build/index.mjs","types":"./build/index.d.ts"},"./adapaters/*":{"import":"./build/adapters/*.js","default":"./build/adapters/*.js","types":"./build/adapters/*.d.ts"},"./adapters":{"import":"./build/adapters/index.js","default":"./build/adapters/index.js","types":"./build/adapters/index.d.ts"}},"devDependencies":{"@types/jsonwebtoken":"^8.5.9","@types/ms":"^0.7.31","@types/node":"^18.11.9","@typescript-eslint/eslint-plugin":"^5.42.0","@typescript-eslint/parser":"^5.42.0","@vitest/coverage-c8":"^0.24.5","@vitest/ui":"^0.24.5","axios":"^1.1.3","eslint":"^8.26.0","eslint-config-prettier":"^8.5.0","eslint-import-resolver-typescript":"^3.5.2","eslint-plugin-import":"^2.26.0","eslint-plugin-unused-imports":"^2.0.0","prettier":"^2.7.1","tsup":"^6.3.0","turbo":"^1.6.3","typescript":"^4.8.4","vite-tsconfig-paths":"^3.5.2","vitest":"^0.24.5"},"peerDependencies":{"axios":"^1.1.3"},"dependencies":{"jsonwebtoken":"^8.5.1","jwt-decode":"^3.1.2","ms":"^2.1.3"},"gitHead":"c0510adfce46b6e8e087dcd096f4d287bd5af0ef","_id":"@aquacloud/axios-jwt@0.0.1","_nodeVersion":"16.15.1","_npmVersion":"8.11.0","dist":{"integrity":"sha512-/15xkvAq7jh5jTK55dnK/PBUFGDIYsLy3guLus39SUvZz2KY2Ey8zWsvaRmeSYJ/hN6IPgSaGxvWQwlnkNbMGg==","shasum":"798242a81f7804eb27fca8582afa8afe02802ed9","tarball":"https://registry.npmjs.org/@aquacloud/axios-jwt/-/axios-jwt-0.0.1.tgz","fileCount":53,"unpackedSize":50650,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIDva/kgN2jjo4NXkqBwrztFvca7aqs4T8SUY4cEIKimnAiAKfXqr528dk/l8uktw15Iu3t34l3M/riNSBC/6J3zPXg=="}],"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjdlKqACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmqKSQ/9HVRhZm3CDEb9P968ewTHQRySd1zLKm7uqSQO6pOKNjcVQ3Bb\r\nKSE15C7YizrD4pmJYRXq7Nya2edPvF83MG8n7BC11f4TwjvtBK9k34L0zsnx\r\nu+geXUjols5T0e4U0xnGI/DSgpTUDVXrn2KuoBTJwt3ZJWXQg5mGCyAhbWm+\r\n+QEBkNn2bxAm330ZszMVjtt5JeEwJN8q+Dc6oOkbcTFZ1P7KsN5RqtjNKFrw\r\n5jnmSUJ7qYzl+E1TPkguvYMKJL4qnttlDwe0Xnbid0D7NXAjz3kMT6pcaHlD\r\n7fhuEvXY7rG84ywJ6jDfVtKcVugiMMNrkHT4jOj5RuNxQmNGdy/l6oHkl3bN\r\noHe0HdrKhxLBgrw3nSZ1QryRxL+irwzA2QefNYpskB4oaNDE2dnsRapX1TsS\r\nWKcCchmmaXwbxxpJ3KThG686G32oT8MTg3o6tl6cqFNdfF/J4CdmaCSlCxjE\r\npWoQjfq9ow+O5nWZJSvfwRN3RN3r5fp1sgyoqqD+pPxspySNkPSKJYrTK8GB\r\niOiCreg5YxPlHw7RGe8fCfo/3dmY5N/8i80wtOTdhA6zctrYXT9AhRX9mOh6\r\n5zrRhtcJ6waSRS+bxe3vAOuMXItbkrl+X31er1zD6Z0tIS4uC1obrFL5sMi1\r\namd6zo88FdMj3jrNyoz+SbjHVJj00U/gM/A=\r\n=goV8\r\n-----END PGP SIGNATURE-----\r\n"},"_npmUser":{"name":"rawnly","email":"fedevitale99@gmail.com"},"directories":{},"maintainers":[{"name":"rawnly","email":"fedevitale99@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/axios-jwt_0.0.1_1668698794232_0.7416065580946378"},"_hasShrinkwrap":false},"0.0.2":{"name":"@aquacloud/axios-jwt","version":"0.0.2","description":"Handle rotating tokens without pain","main":"build/index.js","types":"build/index.d.ts","license":"MIT","author":{"name":"Federico Vitale","email":"federico.vitale@aquacloud.it"},"keywords":["api","jwt","auth","refresh","axios"],"contributors":[],"scripts":{"coverage":"vitest run -c ./config/vitest.config.ts --coverage","test":"vitest -c ./config/vitest.config.ts","build":"tsup src --config ./config/tsup.config.ts","lint-fix":"eslint src/**/*.ts --fix","lint":"eslint src/**/*.ts","dev":"tsup src --watch --config ./config/tsup.config.ts","prepublishOnly":"pnpm build"},"exports":{".":{"default":"./build/index.js","import":"./build/index.mjs","types":"./build/index.d.ts"},"./adapaters/*":{"import":"./build/adapters/*.js","default":"./build/adapters/*.js","types":"./build/adapters/*.d.ts"},"./adapters":{"import":"./build/adapters/index.js","default":"./build/adapters/index.js","types":"./build/adapters/index.d.ts"}},"devDependencies":{"@types/jsonwebtoken":"^8.5.9","@types/ms":"^0.7.31","@types/node":"^18.11.9","@typescript-eslint/eslint-plugin":"^5.42.0","@typescript-eslint/parser":"^5.42.0","@vitest/coverage-c8":"^0.24.5","@vitest/ui":"^0.24.5","axios":"^1.1.3","eslint":"^8.26.0","eslint-config-prettier":"^8.5.0","eslint-import-resolver-typescript":"^3.5.2","eslint-plugin-import":"^2.26.0","eslint-plugin-unused-imports":"^2.0.0","prettier":"^2.7.1","tsup":"^6.3.0","turbo":"^1.6.3","typescript":"^4.8.4","vite-tsconfig-paths":"^3.5.2","vitest":"^0.24.5"},"peerDependencies":{"axios":"^1.1.3"},"dependencies":{"jwt-decode":"^3.1.2","ms":"^2.1.3"},"gitHead":"7a9a5a9b0cdb00ec2a81cfa92e2cf7bb74b44071","_id":"@aquacloud/axios-jwt@0.0.2","_nodeVersion":"16.15.1","_npmVersion":"8.11.0","dist":{"integrity":"sha512-/GLnG4HLlD5FYbG8S2lQOWTNCh2eMpAsHnB5ZuhL8J2YCLKp1uUOa2dQoat5AtWtJu5Xl57bOVRMJGSs4s0rxw==","shasum":"685238b5bc95bc810bd0daed0f19cd64d8438703","tarball":"https://registry.npmjs.org/@aquacloud/axios-jwt/-/axios-jwt-0.0.2.tgz","fileCount":32,"unpackedSize":31281,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQCw0Ufv5oa+3/+Eii3JGfjYCHqxyH36R2czHQ7Y/pFjUQIhAOMOOXX8U0/iZgct5Ist+A1TsTsKW+FVq38gIA53x8Sm"}],"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjfMaLACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmosaQ//WHuBJUQoS2svXAfcV+2r63VNKr6s4HfDRtlvr4rjh0ZbdN8R\r\n8PFZhZujYc6ozLBESKDO3ausryolUxb40zdOrC5w/kqWHt8C00Jpod1xfEs6\r\nEzINDG+tXdpZCwTPOUnfybkfrIF8nIRl/uTFSBjcnYu3n8LFNchKzN6xcIwz\r\ncgQAr1/Dlk3fww6xhvX+ZltSVkuxm8bcXeEXj27FrsHqDhUK0TE9wjaB7jGC\r\ni+WOzQ4RNbvubTUKSf8GoFmUKFdJCU5qi3TMvD6CqQ42cDvI65uy+gYJU32J\r\nBmtKVKhVqjMV4jpEDgi3xVl8Li9urPyOysTVpN6yh44v4e8F/fW7uF21o0Nr\r\nPryYqygQjuEJk7eaCjHncvasOOpMOaeLtdD1ipLQ2TB8BiuqigimgltUl4wk\r\nJPT82gDteUgYsGShOnG7MI4UKPRR52oWwDD2JJhNP39ZMVu5TaXInHJBd2k/\r\nfl4S9qvr4ut6lqZNCHnI0G6zi3CjixwojQFDZ9gYZeA2WkmEJNLiki9WEiiN\r\nju+2Cm/FkmopwBVzPh4tOESPzGajGN8LNok0hMd4BILxoZAANJuU8a7nOxHQ\r\n75MkO8zpVWCuxgMfoZ70VGUKDvSpUSvnvm8vQd7cChdaQ52DbaKsPtXJC/WK\r\nZjsEs7S4TUN+j0mtRAy23Q1dF2zHy3CXlx4=\r\n=Ilj9\r\n-----END PGP SIGNATURE-----\r\n"},"_npmUser":{"name":"rawnly","email":"fedevitale99@gmail.com"},"directories":{},"maintainers":[{"name":"filippo.cozzini","email":"filippo.cozzini@aquacloud.it"},{"name":"rawnly","email":"fedevitale99@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/axios-jwt_0.0.2_1669121674794_0.7905078119491546"},"_hasShrinkwrap":false},"0.0.3-alpha":{"name":"@aquacloud/axios-jwt","version":"0.0.3-alpha","description":"Handle rotating tokens without pain","main":"build/index.js","types":"build/index.d.ts","license":"MIT","author":{"name":"Federico Vitale","email":"federico.vitale@aquacloud.it"},"keywords":["api","jwt","auth","refresh","axios"],"contributors":[],"scripts":{"coverage":"vitest run -c ./config/vitest.config.ts --coverage","test":"vitest -c ./config/vitest.config.ts","build":"tsup src --config ./config/tsup.config.ts","lint-fix":"eslint src/**/*.ts --fix","lint":"eslint src/**/*.ts","dev":"tsup src --watch --config ./config/tsup.config.ts","prepublishOnly":"pnpm build"},"exports":{".":{"default":"./build/index.js","import":"./build/index.mjs","types":"./build/index.d.ts"},"./adapaters/*":{"import":"./build/adapters/*.js","default":"./build/adapters/*.js","types":"./build/adapters/*.d.ts"},"./adapters":{"import":"./build/adapters/index.js","default":"./build/adapters/index.js","types":"./build/adapters/index.d.ts"}},"devDependencies":{"@types/jsonwebtoken":"^8.5.9","@types/ms":"^0.7.31","@types/node":"^18.11.9","@typescript-eslint/eslint-plugin":"^5.42.0","@typescript-eslint/parser":"^5.42.0","@vitest/coverage-c8":"^0.24.5","@vitest/ui":"^0.24.5","axios":"^1.1.3","eslint":"^8.26.0","eslint-config-prettier":"^8.5.0","eslint-import-resolver-typescript":"^3.5.2","eslint-plugin-import":"^2.26.0","eslint-plugin-unused-imports":"^2.0.0","prettier":"^2.7.1","tsup":"^6.3.0","turbo":"^1.6.3","typescript":"^4.8.4","vite-tsconfig-paths":"^3.5.2","vitest":"^0.24.5"},"peerDependencies":{"axios":"^1.1.3"},"dependencies":{"jwt-decode":"^3.1.2","ms":"^2.1.3"},"readme":"# Axios JWT\n\n> A porting of the original `jetbridge/axios-jwt` with support to custom storage and ssr.\n\n## Installation\n\n```sh\n  npm install @aquacloud/axios-jwt\n```\n\n## Usage\n\n```ts\n// api.ts\n\nimport AxiosJwt, { type RequestRefresh } from \"@aquacloud/axios-jwt\";\nimport CookieStorage from \"@aquacloud/axios-jwt/adapters/cookie-storage\";\nimport axios from \"axios\";\n\n// Create an axios instance\nexport const api = axios.create({ baseURL: \"http://localhost:8080/api\" });\n\nconst requestRefresh: RequestRefresh = async (tokens: Tokens) => {\n    // DO NOT USE THE `api` INSTANCE\n    const response = await axios.post(\"http://localhost:3000\", tokens, {\n        headers: {\n            Authorization: `Bearer ${tokens.accessToken}`,\n        },\n    });\n\n    return response.data;\n};\n\n// Initialize the class\nexport const tokenInterceptor = new AxiosJwt({\n    requestRefresh,\n    // just an object that implements the web Storage interface\n    storage: new CookieStorage(), // or window.localStorage, window.sessionStorage\n    options: {\n        header: \"Authorization\",\n        headerPrefix: \"Bearer \", // NOTE: must include the space\n        // Value can be number (milliseconds) or string (see more at https://github.com/vercel/ms)\n        leeway: \"10s\",\n    },\n});\n\n// Apply the interceptor\ntokenInterceptor.apply(api);\n\n// or apply manually\napi.interceptors.request.use(tokenInterceptor.interceptor);\n```\n\n## Login / Logout\n\n```ts\n// auth.ts\n\nimport { tokenInterceptor, api } from \"./api\";\n\nconst login = async (username: string, password: string) => {\n    const response = await api.post(\"/auth/sign-in\", { username, password });\n\n    tokenInterceptor.accessToken = response.data.accessToken;\n    tokenInterceptor.refreshToken = response.data.refreshToken;\n\n    // or\n    tokenInterceptor.tokens = response.data;\n};\n```\n\nThe following example is a simple react implementation. It can be used with any framework.\n\n```tsx\n// Profile.tsx\nimport { useState } from \"react\";\nimport { api } from \"./api\";\n\nfunction Profile() {\n    const [user, setUser] = useState(null);\n\n    useEffect(() => {\n        api.get(\"/users/me\").then(response => setUser(response.data));\n    }, []);\n\n    if (!tokenInterceptor.isLoggedIn || !user) return null;\n\n    return (\n        <div>\n            {user.firstName} {user.lastName}\n        </div>\n    );\n}\n```\n\n## Utilities\n\n```ts\nimport { tokenInterceptor } from \"./api\";\n\ntokenInterceptor.isLoggedIn; // check if is logged in\ntokenInterceptor.accessToken; // read-write accessToken\ntokenInterceptor.refreshToken; // read-write refreshToken\ntokenInterceptor.clearTokens(); // sets `accessToken` and `refreshToken` to undefined\n```\n","readmeFilename":"README.md","gitHead":"7a9a5a9b0cdb00ec2a81cfa92e2cf7bb74b44071","_id":"@aquacloud/axios-jwt@0.0.3-alpha","_nodeVersion":"16.15.1","_npmVersion":"8.11.0","dist":{"integrity":"sha512-Vf8cdLJZd7jyDAbbmQ76yE9mL2XCFzt5zIx6P8iNEx74WTEM36bZQIO67CgJ2ifuaLG7KwhawUPLO/5pCKHrIQ==","shasum":"8b586d6dfa6de37c4761ee926142193b55d79078","tarball":"https://registry.npmjs.org/@aquacloud/axios-jwt/-/axios-jwt-0.0.3-alpha.tgz","fileCount":32,"unpackedSize":31091,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIHShCNOCNJQpVpUagi75rgoi6OKV/QQffGVaAGGwkFcKAiEA+OOk4mbOGZzXQWaXNlEzS0EZQMJsNpmm/fVTjHIzzKY="}],"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjfMghACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmrwOA/5AbUH8H73jKhME9aU01hFmcVZaMfLTp9/cEE0QBu68+DrdPDd\r\nzVJwJZBEP8pa95C1WhuXU1liNmB1ZTJdo6LNNQTufN2W/cp60fcmlXgesfnb\r\nTQKVUsDhGq8ubqM9opnoPTtCI8DFFW1xwvd/FhwQ9pfBHpRC6+qR4GEYmx52\r\nnVM4DjXTQJYcD5EuYoKXlI66LccP1mf/ehi0XR7X2lfD+3mSCEUpn7Pkl5ct\r\nconuZpLF4WqpAmj0gCucOFJv0qUIQdQuRXzsdM/jvQGz21xEMn76SddOCjKw\r\nX6kUNXbfQxfIh0IGj4MFBqXbN3kGn1PigsZJ/P17VYi4n/yPvHB2dulhayjA\r\nMMddXRTChX7DIRSPaBFUrPaDboiJR9ljgWWL140es2N0IanqLXPV2GGyUjxt\r\nKp0fnc+D9IxeOPInx3c1LjPWu6Na93H2V/Ww2YMEGA0Lsh5lx3vJAxh+Pb6A\r\nqM5XyrYAgrf7J8H6JvHBGRhcHircFAEeoE8SXj/luqrh9jf2bfPQAFM0t43i\r\nxK/H5FHneqOQp2F2lO9+wFcZDNVvZTXLiMBrSkZnvMdUg+ms+f+fFvZwpNm2\r\niBCEdiHfjmRaLrjGaVHmKUP9zn0NXnpvgTQaIZ29G22MykFRjNG3+NFJ7wS3\r\n+4LCaA2wAp4A9RbmiTwjsJLnt4YWDC6+FE0=\r\n=Abs9\r\n-----END PGP SIGNATURE-----\r\n"},"_npmUser":{"name":"rawnly","email":"fedevitale99@gmail.com"},"directories":{},"maintainers":[{"name":"filippo.cozzini","email":"filippo.cozzini@aquacloud.it"},{"name":"rawnly","email":"fedevitale99@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/axios-jwt_0.0.3-alpha_1669122081100_0.48955386222835795"},"_hasShrinkwrap":false},"0.0.3-alpha.2":{"name":"@aquacloud/axios-jwt","version":"0.0.3-alpha.2","description":"Handle rotating tokens without pain","main":"build/index.js","types":"build/index.d.ts","license":"MIT","author":{"name":"Federico Vitale","email":"federico.vitale@aquacloud.it"},"keywords":["api","jwt","auth","refresh","axios"],"contributors":[],"scripts":{"coverage":"vitest run -c ./config/vitest.config.ts --coverage","test":"vitest -c ./config/vitest.config.ts","build":"tsup src --config ./config/tsup.config.ts","lint-fix":"eslint src/**/*.ts --fix","lint":"eslint src/**/*.ts","dev":"tsup src --watch --config ./config/tsup.config.ts","prepublishOnly":"pnpm build"},"exports":{".":{"default":"./build/index.js","import":"./build/index.mjs","types":"./build/index.d.ts"},"./adapaters/*":{"import":"./build/adapters/*.js","default":"./build/adapters/*.js","types":"./build/adapters/*.d.ts"},"./adapters":{"import":"./build/adapters/index.js","default":"./build/adapters/index.js","types":"./build/adapters/index.d.ts"}},"devDependencies":{"@types/jsonwebtoken":"^8.5.9","@types/ms":"^0.7.31","@types/node":"^18.11.9","@typescript-eslint/eslint-plugin":"^5.42.0","@typescript-eslint/parser":"^5.42.0","@vitest/coverage-c8":"^0.24.5","@vitest/ui":"^0.24.5","axios":"^1.1.3","eslint":"^8.26.0","eslint-config-prettier":"^8.5.0","eslint-import-resolver-typescript":"^3.5.2","eslint-plugin-import":"^2.26.0","eslint-plugin-unused-imports":"^2.0.0","prettier":"^2.7.1","tsup":"^6.3.0","turbo":"^1.6.3","typescript":"^4.8.4","vite-tsconfig-paths":"^3.5.2","vitest":"^0.24.5"},"peerDependencies":{"axios":"^1.1.3"},"dependencies":{"jwt-decode":"^3.1.2","ms":"^2.1.3"},"readme":"# Axios JWT\n\n> A porting of the original `jetbridge/axios-jwt` with support to custom storage and ssr.\n\n## Installation\n\n```sh\n  npm install @aquacloud/axios-jwt\n```\n\n## Usage\n\n```ts\n// api.ts\n\nimport AxiosJwt, { type RequestRefresh } from \"@aquacloud/axios-jwt\";\nimport CookieStorage from \"@aquacloud/axios-jwt/adapters/cookie-storage\";\nimport axios from \"axios\";\n\n// Create an axios instance\nexport const api = axios.create({ baseURL: \"http://localhost:8080/api\" });\n\nconst requestRefresh: RequestRefresh = async (tokens: Tokens) => {\n    // DO NOT USE THE `api` INSTANCE\n    const response = await axios.post(\"http://localhost:3000\", tokens, {\n        headers: {\n            Authorization: `Bearer ${tokens.accessToken}`,\n        },\n    });\n\n    return response.data;\n};\n\n// Initialize the class\nexport const tokenInterceptor = new AxiosJwt({\n    requestRefresh,\n    // just an object that implements the web Storage interface\n    storage: new CookieStorage(), // or window.localStorage, window.sessionStorage\n    options: {\n        header: \"Authorization\",\n        headerPrefix: \"Bearer \", // NOTE: must include the space\n        // Value can be number (milliseconds) or string (see more at https://github.com/vercel/ms)\n        leeway: \"10s\",\n    },\n});\n\n// Apply the interceptor\ntokenInterceptor.apply(api);\n\n// or apply manually\napi.interceptors.request.use(tokenInterceptor.interceptor);\n```\n\n## Login / Logout\n\n```ts\n// auth.ts\n\nimport { tokenInterceptor, api } from \"./api\";\n\nconst login = async (username: string, password: string) => {\n    const response = await api.post(\"/auth/sign-in\", { username, password });\n\n    tokenInterceptor.accessToken = response.data.accessToken;\n    tokenInterceptor.refreshToken = response.data.refreshToken;\n\n    // or\n    tokenInterceptor.tokens = response.data;\n};\n```\n\nThe following example is a simple react implementation. It can be used with any framework.\n\n```tsx\n// Profile.tsx\nimport { useState } from \"react\";\nimport { api } from \"./api\";\n\nfunction Profile() {\n    const [user, setUser] = useState(null);\n\n    useEffect(() => {\n        api.get(\"/users/me\").then(response => setUser(response.data));\n    }, []);\n\n    if (!tokenInterceptor.isLoggedIn || !user) return null;\n\n    return (\n        <div>\n            {user.firstName} {user.lastName}\n        </div>\n    );\n}\n```\n\n## Utilities\n\n```ts\nimport { tokenInterceptor } from \"./api\";\n\ntokenInterceptor.isLoggedIn; // check if is logged in\ntokenInterceptor.accessToken; // read-write accessToken\ntokenInterceptor.refreshToken; // read-write refreshToken\ntokenInterceptor.clearTokens(); // sets `accessToken` and `refreshToken` to undefined\n```\n","readmeFilename":"README.md","gitHead":"7a9a5a9b0cdb00ec2a81cfa92e2cf7bb74b44071","_id":"@aquacloud/axios-jwt@0.0.3-alpha.2","_nodeVersion":"16.15.1","_npmVersion":"8.11.0","dist":{"integrity":"sha512-r/kE3Hgtn6rc/Be+lUaZFRvMc87dTi0gB3/XHpoakVCnlMrLmD+YtngbO1rGbr0rPl7KP8QZoMCbMzu2BpBHHg==","shasum":"4051e4eb2144d3229e113b2fd0d32bd798cdf895","tarball":"https://registry.npmjs.org/@aquacloud/axios-jwt/-/axios-jwt-0.0.3-alpha.2.tgz","fileCount":32,"unpackedSize":31287,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIA5QDUvqBl3AvSbK7IgICXkUN6csEYxX+EY0hYrV7qKZAiATQ6w6MlNOpfa9fIx0AO2PhdcHPgGa6mBpbj2UXwbkbA=="}],"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjfMlJACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmqpmg//e2URt/rEuUJSpklXNW6TamFSlC/dXEE+r9oDWqqiCEh+3kvp\r\nDin9KAUb8YvbMYJ2pX4hEgGaderM073lSSpmdQ7Q6I34BNamrZb4lb8deBPS\r\nBninWBlO0s0gJqyIXaNujXTAwDsDeMdphHsQvZAFwsTZ2nbcR5zGGBQD+lpx\r\nXVLE0lgSYm629R/uuoGhIAV82jt/AGbtMRinTuE7MGt+dhTad6/O71UUOB8K\r\ngl5WfTBjH3QIQYjbkDGq7NiiZx/TQ9F0bC2ILIZbtRqNuGXfas9tm8ZCH5K5\r\nASageMWl4Dl/GNFFmenXEaf0CH/iNGQ2T25iibTubA+8+Aomh5S5WS9ZIWUf\r\ni50f9O+MrySRDy9nUwVO8f/thZ7wMeHe9riXPhAMw2M9sZVJm6sPDO8k0ZIh\r\nWgz0Lv4aYrM8i28rHkE9TuodUJ7uitUNoO+DXvlciwRAeQcqlRLxpedU88ZM\r\nEQc7Eppxb5hfMZCnUywabuHIfGuNm5eDyddvEYUh9wDrMcgleCA/6ZyrEasb\r\nnlCRJ41CY4XkMcwR+bx+TO6kGnqD6Azi75mfXtgpGkB9Lgie1EgDPSqr+xX6\r\n4Sa13Q7TT3TCYL/Y63jmT2bbRYl4vZrz1F8XJQqkRvij6Wg9DXl4XSRfXOdB\r\nbTR3wz/MT+p5G8TtzhUWrg0VkgAA0yUf/Ls=\r\n=FrIT\r\n-----END PGP SIGNATURE-----\r\n"},"_npmUser":{"name":"rawnly","email":"fedevitale99@gmail.com"},"directories":{},"maintainers":[{"name":"filippo.cozzini","email":"filippo.cozzini@aquacloud.it"},{"name":"rawnly","email":"fedevitale99@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/axios-jwt_0.0.3-alpha.2_1669122377201_0.7238711625841274"},"_hasShrinkwrap":false},"0.0.3-alpha.3":{"name":"@aquacloud/axios-jwt","version":"0.0.3-alpha.3","description":"Handle rotating tokens without pain","main":"build/index.js","types":"build/index.d.ts","license":"MIT","author":{"name":"Federico Vitale","email":"federico.vitale@aquacloud.it"},"keywords":["api","jwt","auth","refresh","axios"],"contributors":[],"scripts":{"coverage":"vitest run -c ./config/vitest.config.ts --coverage","test":"vitest -c ./config/vitest.config.ts","build":"tsup src --config ./config/tsup.config.ts","lint-fix":"eslint src/**/*.ts --fix","lint":"eslint src/**/*.ts","dev":"tsup src --watch --config ./config/tsup.config.ts","prepublishOnly":"pnpm build"},"exports":{".":{"default":"./build/index.js","import":"./build/index.mjs","types":"./build/index.d.ts"},"./adapaters/*":{"import":"./build/adapters/*.js","default":"./build/adapters/*.js","types":"./build/adapters/*.d.ts"},"./adapters":{"import":"./build/adapters/index.js","default":"./build/adapters/index.js","types":"./build/adapters/index.d.ts"}},"devDependencies":{"@types/jsonwebtoken":"^8.5.9","@types/ms":"^0.7.31","@types/node":"^18.11.9","@typescript-eslint/eslint-plugin":"^5.42.0","@typescript-eslint/parser":"^5.42.0","@vitest/coverage-c8":"^0.24.5","@vitest/ui":"^0.24.5","axios":"^1.1.3","eslint":"^8.26.0","eslint-config-prettier":"^8.5.0","eslint-import-resolver-typescript":"^3.5.2","eslint-plugin-import":"^2.26.0","eslint-plugin-unused-imports":"^2.0.0","prettier":"^2.7.1","tsup":"^6.3.0","turbo":"^1.6.3","typescript":"^4.8.4","vite-tsconfig-paths":"^3.5.2","vitest":"^0.24.5"},"peerDependencies":{"axios":"^1.1.3"},"dependencies":{"jwt-decode":"^3.1.2","ms":"^2.1.3"},"readme":"# Axios JWT\n\n> A porting of the original `jetbridge/axios-jwt` with support to custom storage and ssr.\n\n## Installation\n\n```sh\n  npm install @aquacloud/axios-jwt\n```\n\n## Usage\n\n```ts\n// api.ts\n\nimport AxiosJwt, { type RequestRefresh } from \"@aquacloud/axios-jwt\";\nimport CookieStorage from \"@aquacloud/axios-jwt/adapters/cookie-storage\";\nimport axios from \"axios\";\n\n// Create an axios instance\nexport const api = axios.create({ baseURL: \"http://localhost:8080/api\" });\n\nconst requestRefresh: RequestRefresh = async (tokens: Tokens) => {\n    // DO NOT USE THE `api` INSTANCE\n    const response = await axios.post(\"http://localhost:3000\", tokens, {\n        headers: {\n            Authorization: `Bearer ${tokens.accessToken}`,\n        },\n    });\n\n    return response.data;\n};\n\n// Initialize the class\nexport const tokenInterceptor = new AxiosJwt({\n    requestRefresh,\n    // just an object that implements the web Storage interface\n    storage: new CookieStorage(), // or window.localStorage, window.sessionStorage\n    options: {\n        header: \"Authorization\",\n        headerPrefix: \"Bearer \", // NOTE: must include the space\n        // Value can be number (milliseconds) or string (see more at https://github.com/vercel/ms)\n        leeway: \"10s\",\n    },\n});\n\n// Apply the interceptor\ntokenInterceptor.apply(api);\n\n// or apply manually\napi.interceptors.request.use(tokenInterceptor.interceptor);\n```\n\n## Login / Logout\n\n```ts\n// auth.ts\n\nimport { tokenInterceptor, api } from \"./api\";\n\nconst login = async (username: string, password: string) => {\n    const response = await api.post(\"/auth/sign-in\", { username, password });\n\n    tokenInterceptor.accessToken = response.data.accessToken;\n    tokenInterceptor.refreshToken = response.data.refreshToken;\n\n    // or\n    tokenInterceptor.tokens = response.data;\n};\n```\n\nThe following example is a simple react implementation. It can be used with any framework.\n\n```tsx\n// Profile.tsx\nimport { useState } from \"react\";\nimport { api } from \"./api\";\n\nfunction Profile() {\n    const [user, setUser] = useState(null);\n\n    useEffect(() => {\n        api.get(\"/users/me\").then(response => setUser(response.data));\n    }, []);\n\n    if (!tokenInterceptor.isLoggedIn || !user) return null;\n\n    return (\n        <div>\n            {user.firstName} {user.lastName}\n        </div>\n    );\n}\n```\n\n## Utilities\n\n```ts\nimport { tokenInterceptor } from \"./api\";\n\ntokenInterceptor.isLoggedIn; // check if is logged in\ntokenInterceptor.accessToken; // read-write accessToken\ntokenInterceptor.refreshToken; // read-write refreshToken\ntokenInterceptor.clearTokens(); // sets `accessToken` and `refreshToken` to undefined\n```\n","readmeFilename":"README.md","gitHead":"7a9a5a9b0cdb00ec2a81cfa92e2cf7bb74b44071","_id":"@aquacloud/axios-jwt@0.0.3-alpha.3","_nodeVersion":"16.15.1","_npmVersion":"8.11.0","dist":{"integrity":"sha512-mbfaFOcaTAjfiEYr2UPe5toZTqOKFIIoZuJBaLEg8zJwlpr5KhkOdKXXqOlXdPo5JMlFu0Cm7c2UgGgAU1BNtA==","shasum":"9882ebc1e2de877584209bf39775d7fac9ee42f5","tarball":"https://registry.npmjs.org/@aquacloud/axios-jwt/-/axios-jwt-0.0.3-alpha.3.tgz","fileCount":32,"unpackedSize":31432,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIG91dl2dZfQEONQaHG9RO1fYMtIbcGSSxeyaMvGGio3XAiAWykAMcphKQGYLGtVrdJMqX/x5tNNLVBZ/ytV3fTUwug=="}],"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjfMn/ACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmqu3A//UcXxm8EwzaA+fl/NNnuTQbYYmMZlHnnaiiHPMYb/VhvzqYYh\r\nvfroqPANBMkt0Dqa4iDWvaHZbRaeUEOm6MIaMOamkDehpL7J0Z5BgdPT7GIa\r\nWKo0J7sfpuzo9/Gpzh5Pvzyqu46f5tU6jCWKVSH2hAUuUIsOHhTzOCtpazL8\r\n2IgG7Cg6X/sASxMZqU2sZbyjqSIUfcou1k65ZQMFMcpXJD/+LwJhmYqjr/Bf\r\n8ipEUsmuN+01HyLNce8WWL1oOfostdlQhX6BaP/FWee/yHqGnRauZCGvzFh5\r\nr0T4naG8zFPcB734lJZyGp63tR9qY+y0T9GnZFelYoSPtQPiViXAsRCLKJ1o\r\n324ByghMnu2uR19LzTl0X1ARpYj4kuXbENCzuiN7nE6vmZuGLpK8cKQiuxCU\r\nyPWmZygL9UKvcss3ZX0S3RdO3RnfbshaiYqKY00z8Q9CgpwAibJx+S3sy9Th\r\n6y9uM/VSBkWYTq/D99yUhh5Grx7GTy2etozfWDZvsB+Por7B/nsTkmHBI/yf\r\nxed1GohBKxkdEgSCrpJOAhUQlSNXXOXEvJZfiJN8twMW0PZeEc3MK4H5b3g+\r\ngdA30Z9wqzVhzXel9sWSjQ3FAPIAaBhS4N/tEEeITitIT1m7GnEkrRIZno6r\r\nwyDH1z+YupoRjFh//pHj2gfjTIulk/cWDBg=\r\n=x9fm\r\n-----END PGP SIGNATURE-----\r\n"},"_npmUser":{"name":"rawnly","email":"fedevitale99@gmail.com"},"directories":{},"maintainers":[{"name":"filippo.cozzini","email":"filippo.cozzini@aquacloud.it"},{"name":"rawnly","email":"fedevitale99@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/axios-jwt_0.0.3-alpha.3_1669122559532_0.8576267418522696"},"_hasShrinkwrap":false},"0.0.3-alpha.5":{"name":"@aquacloud/axios-jwt","version":"0.0.3-alpha.5","description":"Handle rotating tokens without pain","main":"build/index.js","types":"build/index.d.ts","license":"MIT","author":{"name":"Federico Vitale","email":"federico.vitale@aquacloud.it"},"keywords":["api","jwt","auth","refresh","axios"],"contributors":[{"name":"rawnly"}],"scripts":{"coverage":"vitest run -c ./config/vitest.config.ts --coverage","test":"vitest -c ./config/vitest.config.ts","build":"tsup src --config ./config/tsup.config.ts","lint-fix":"eslint src/**/*.ts --fix","lint":"eslint src/**/*.ts","dev":"tsup src --watch --config ./config/tsup.config.ts","prepublishOnly":"pnpm build"},"exports":{".":{"default":"./build/index.js","import":"./build/index.mjs","types":"./build/index.d.ts"},"./adapaters/*":{"import":"./build/adapters/*.js","default":"./build/adapters/*.js","types":"./build/adapters/*.d.ts"},"./adapters":{"import":"./build/adapters/index.js","default":"./build/adapters/index.js","types":"./build/adapters/index.d.ts"}},"devDependencies":{"@types/jsonwebtoken":"^8.5.9","@types/ms":"^0.7.31","@types/node":"^18.11.9","@typescript-eslint/eslint-plugin":"^5.42.0","@typescript-eslint/parser":"^5.42.0","@vitest/coverage-c8":"^0.24.5","@vitest/ui":"^0.24.5","axios":"^1.1.3","eslint":"^8.26.0","eslint-config-prettier":"^8.5.0","eslint-import-resolver-typescript":"^3.5.2","eslint-plugin-import":"^2.26.0","eslint-plugin-unused-imports":"^2.0.0","jsonwebtoken":"^8.5.1","prettier":"^2.7.1","tsup":"^6.3.0","turbo":"^1.6.3","typescript":"^4.8.4","vite-tsconfig-paths":"^3.5.2","vitest":"^0.24.5"},"peerDependencies":{"axios":"^1.1.3"},"dependencies":{"jwt-decode":"^3.1.2","ms":"^2.1.3"},"readme":"# Axios JWT\n\n> A porting of the original `jetbridge/axios-jwt` with support to custom storage and ssr.\n\n## Installation\n\n```sh\n  npm install @aquacloud/axios-jwt\n```\n\n## Usage\n\n```ts\n// api.ts\n\nimport AxiosJwt, { type RequestRefresh } from \"@aquacloud/axios-jwt\";\nimport CookieStorage from \"@aquacloud/axios-jwt/adapters/cookie-storage\";\nimport axios from \"axios\";\n\n// Create an axios instance\nexport const api = axios.create({ baseURL: \"http://localhost:8080/api\" });\n\nconst requestRefresh: RequestRefresh = async (tokens: Tokens) => {\n    // DO NOT USE THE `api` INSTANCE\n    const response = await axios.post(\"http://localhost:3000\", tokens, {\n        headers: {\n            Authorization: `Bearer ${tokens.accessToken}`,\n        },\n    });\n\n    return response.data;\n};\n\n// Initialize the class\nexport const tokenInterceptor = new AxiosJwt({\n    requestRefresh,\n    // just an object that implements the web Storage interface\n    storage: new CookieStorage(), // or window.localStorage, window.sessionStorage\n    options: {\n        header: \"Authorization\",\n        headerPrefix: \"Bearer \", // NOTE: must include the space\n        // Value can be number (milliseconds) or string (see more at https://github.com/vercel/ms)\n        leeway: \"10s\",\n    },\n});\n\n// Apply the interceptor\ntokenInterceptor.apply(api);\n\n// or apply manually\napi.interceptors.request.use(tokenInterceptor.interceptor);\n```\n\n## Login / Logout\n\n```ts\n// auth.ts\n\nimport { tokenInterceptor, api } from \"./api\";\n\nconst login = async (username: string, password: string) => {\n    const response = await api.post(\"/auth/sign-in\", { username, password });\n\n    tokenInterceptor.accessToken = response.data.accessToken;\n    tokenInterceptor.refreshToken = response.data.refreshToken;\n\n    // or\n    tokenInterceptor.tokens = response.data;\n};\n```\n\nThe following example is a simple react implementation. It can be used with any framework.\n\n```tsx\n// Profile.tsx\nimport { useState } from \"react\";\nimport { api } from \"./api\";\n\nfunction Profile() {\n    const [user, setUser] = useState(null);\n\n    useEffect(() => {\n        api.get(\"/users/me\").then(response => setUser(response.data));\n    }, []);\n\n    if (!tokenInterceptor.isLoggedIn || !user) return null;\n\n    return (\n        <div>\n            {user.firstName} {user.lastName}\n        </div>\n    );\n}\n```\n\n## Utilities\n\n```ts\nimport { tokenInterceptor } from \"./api\";\n\ntokenInterceptor.isLoggedIn; // check if is logged in\ntokenInterceptor.accessToken; // read-write accessToken\ntokenInterceptor.refreshToken; // read-write refreshToken\ntokenInterceptor.clearTokens(); // sets `accessToken` and `refreshToken` to undefined\n```\n","readmeFilename":"README.md","gitHead":"7a9a5a9b0cdb00ec2a81cfa92e2cf7bb74b44071","_id":"@aquacloud/axios-jwt@0.0.3-alpha.5","_nodeVersion":"16.15.1","_npmVersion":"8.11.0","dist":{"integrity":"sha512-PB3KBIQA1af5lH8OsNgGaT442aKNaNj1LojL+TtHpjwM0sH536MghWDEOMflrVSEzfWrknlcGJBHxGrE3CePsg==","shasum":"9516aed26526eab0237bc914592ade870971c2ee","tarball":"https://registry.npmjs.org/@aquacloud/axios-jwt/-/axios-jwt-0.0.3-alpha.5.tgz","fileCount":32,"unpackedSize":32262,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQCyGX0YuPp8my7C3M6rR2Cum3cBAtHhUKvepYAKzNIYyQIgRk08pQ3/KpQIAIEVOn6rKVunI/CV75sM4oiSQ7fdyZI="}],"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjfPN5ACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmq0Tw//eBLHuNoKWdPrleFNPt0P86LgMkmIZ1LL8ShxKzEKYC8gl/Kq\r\n9NMybPXE3+vsJG80GnJwtJ9ClU4wO+5CE8uAfyPriwwn1fVOFFW2avgjuoeG\r\nvDMrcoUA6ZqV0nHDpwADt89/bZohp7HPswywid+5t2ZCTSwRG2dhdCgTa/Jx\r\nX5LK9ks7SJ62bmxi9p8MLiOj4QaSAVYWdA6jniCyJBVaYkpp4YyLe3uDc/k+\r\nQygd1y3c5cebeU+zSuLphcjYZ7SZd/3qOwWUXIqw2ytyzlhV6s8nE4Qip2BK\r\nxCQFzVlqxQGc0MR0ZkAOv6YNrOwiTfos+GeRp2EpKlIH+OanriorN9d6VX28\r\nyZF8Q4S4SLrbI+bDAF34yusWSKlHE0fuCp9p1hUKqJIHkLB0A0SMpyzFvX2Y\r\n3C+YRPHekOQSjxK1AIuG6HDE3D0P5uGV/0cstCNPREqsY7aqhX8RwK4HHj8M\r\nKx4SitVLjiX/QCy1WUGZhHOenhia9PNwZi8kXTqW2gAUg0cn3m8M0F+OXWIT\r\nviIY3Ajb4GjHD8shm9mVWLCiGMFL4IjTrYKj74BHBS6iqzurthKiiAJbbDbT\r\n3O2CasFxKnmDhauqtmlb/lWn+meroAk4n8a9kZDXnts0NCAw4p/QYkK1HzxB\r\nX64EyRjGTENZ7fwIzQmUK4IogtiSJ4pNeEA=\r\n=rQ0t\r\n-----END PGP SIGNATURE-----\r\n"},"_npmUser":{"name":"rawnly","email":"fedevitale99@gmail.com"},"directories":{},"maintainers":[{"name":"filippo.cozzini","email":"filippo.cozzini@aquacloud.it"},{"name":"rawnly","email":"fedevitale99@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/axios-jwt_0.0.3-alpha.5_1669133177200_0.46042558030562186"},"_hasShrinkwrap":false},"0.0.3-alpha.6":{"name":"@aquacloud/axios-jwt","version":"0.0.3-alpha.6","description":"Handle rotating tokens without pain","main":"build/index.js","types":"build/index.d.ts","license":"MIT","author":{"name":"Federico Vitale","email":"federico.vitale@aquacloud.it"},"keywords":["api","jwt","auth","refresh","axios"],"contributors":[{"name":"rawnly"}],"scripts":{"coverage":"vitest run -c ./config/vitest.config.ts --coverage","test":"vitest -c ./config/vitest.config.ts","build":"tsup src --config ./config/tsup.config.ts","lint-fix":"eslint src/**/*.ts --fix","lint":"eslint src/**/*.ts","dev":"tsup src --watch --config ./config/tsup.config.ts","prepublishOnly":"pnpm build"},"exports":{".":{"default":"./build/index.js","import":"./build/index.mjs","types":"./build/index.d.ts"},"./adapaters/*":{"import":"./build/adapters/*.js","default":"./build/adapters/*.js","types":"./build/adapters/*.d.ts"},"./adapters":{"import":"./build/adapters/index.js","default":"./build/adapters/index.js","types":"./build/adapters/index.d.ts"}},"devDependencies":{"@types/jsonwebtoken":"^8.5.9","@types/ms":"^0.7.31","@types/node":"^18.11.9","@typescript-eslint/eslint-plugin":"^5.42.0","@typescript-eslint/parser":"^5.42.0","@vitest/coverage-c8":"^0.24.5","@vitest/ui":"^0.24.5","axios":"^1.1.3","eslint":"^8.26.0","eslint-config-prettier":"^8.5.0","eslint-import-resolver-typescript":"^3.5.2","eslint-plugin-import":"^2.26.0","eslint-plugin-unused-imports":"^2.0.0","jsonwebtoken":"^8.5.1","prettier":"^2.7.1","tsup":"^6.3.0","turbo":"^1.6.3","typescript":"^4.8.4","vite-tsconfig-paths":"^3.5.2","vitest":"^0.24.5"},"peerDependencies":{"axios":"^1.1.3"},"dependencies":{"jwt-decode":"^3.1.2","ms":"^2.1.3"},"readme":"# Axios JWT\n\n> A porting of the original `jetbridge/axios-jwt` with support to custom storage and ssr.\n\n## Installation\n\n```sh\n  npm install @aquacloud/axios-jwt\n```\n\n## Usage\n\n```ts\n// api.ts\n\nimport AxiosJwt, { type RequestRefresh } from \"@aquacloud/axios-jwt\";\nimport CookieStorage from \"@aquacloud/axios-jwt/adapters/cookie-storage\";\nimport axios from \"axios\";\n\n// Create an axios instance\nexport const api = axios.create({ baseURL: \"http://localhost:8080/api\" });\n\nconst requestRefresh: RequestRefresh = async (tokens: Tokens) => {\n    // DO NOT USE THE `api` INSTANCE\n    const response = await axios.post(\"http://localhost:3000\", tokens, {\n        headers: {\n            Authorization: `Bearer ${tokens.accessToken}`,\n        },\n    });\n\n    return response.data;\n};\n\n// Initialize the class\nexport const tokenInterceptor = new AxiosJwt({\n    requestRefresh,\n    // just an object that implements the web Storage interface\n    storage: new CookieStorage(), // or window.localStorage, window.sessionStorage\n    options: {\n        header: \"Authorization\",\n        headerPrefix: \"Bearer \", // NOTE: must include the space\n        // Value can be number (milliseconds) or string (see more at https://github.com/vercel/ms)\n        leeway: \"10s\",\n    },\n});\n\n// Apply the interceptor\ntokenInterceptor.apply(api);\n\n// or apply manually\napi.interceptors.request.use(tokenInterceptor.interceptor);\n```\n\n## Login / Logout\n\n```ts\n// auth.ts\n\nimport { tokenInterceptor, api } from \"./api\";\n\nconst login = async (username: string, password: string) => {\n    const response = await api.post(\"/auth/sign-in\", { username, password });\n\n    tokenInterceptor.accessToken = response.data.accessToken;\n    tokenInterceptor.refreshToken = response.data.refreshToken;\n\n    // or\n    tokenInterceptor.tokens = response.data;\n};\n```\n\nThe following example is a simple react implementation. It can be used with any framework.\n\n```tsx\n// Profile.tsx\nimport { useState } from \"react\";\nimport { api } from \"./api\";\n\nfunction Profile() {\n    const [user, setUser] = useState(null);\n\n    useEffect(() => {\n        api.get(\"/users/me\").then(response => setUser(response.data));\n    }, []);\n\n    if (!tokenInterceptor.isLoggedIn || !user) return null;\n\n    return (\n        <div>\n            {user.firstName} {user.lastName}\n        </div>\n    );\n}\n```\n\n## Utilities\n\n```ts\nimport { tokenInterceptor } from \"./api\";\n\ntokenInterceptor.isLoggedIn; // check if is logged in\ntokenInterceptor.accessToken; // read-write accessToken\ntokenInterceptor.refreshToken; // read-write refreshToken\ntokenInterceptor.clearTokens(); // sets `accessToken` and `refreshToken` to undefined\n```\n","readmeFilename":"README.md","gitHead":"7a9a5a9b0cdb00ec2a81cfa92e2cf7bb74b44071","_id":"@aquacloud/axios-jwt@0.0.3-alpha.6","_nodeVersion":"16.15.1","_npmVersion":"8.11.0","dist":{"integrity":"sha512-k96n+lnhGzT8f2MrbjjEx6lDNNKOcSUc3TVkyw1x4552GfU4EWiOqZksrfhBugzlb9pclU841183UsInh2qxDA==","shasum":"609253a66b93dd00edc947a945f91f0ea24ed986","tarball":"https://registry.npmjs.org/@aquacloud/axios-jwt/-/axios-jwt-0.0.3-alpha.6.tgz","fileCount":32,"unpackedSize":32292,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQD7aN4pmOJbkr+YOdcKFWGUcmDhOMZJi39rCxIgCCaulAIhALy8HiwXkh/gNjxUS9bkV1t+574AggN/Fj3RKD9ORaxX"}],"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjfPRxACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmpX0w/9Hez4ghdPcuCU8ZY1DcIY+gvttFOOYfuithY0K7xEbx69qRdm\r\nO/Mtuk8TqwodGwphHxnHzxbyHZzG4xMCbXI2BYufhr84KKgE1VLlF9hcaYOJ\r\nXRKhPtzl7uL7kLHLA+dgFqPYNeKjd4FD7WdvLZKifnod5757NBJMgKvTYSkS\r\nBtotzJp+nvGqT/onQOzdhC3tVxlrRBmWHwP5yQSvJIXV6Vjci7WqGMS1s+MA\r\nPdfMykkCrfrYqOZTCSnCmw/WDKmdi49x2lcyKTWOHKJixE4l8qZYBy+tdyRp\r\nqhGECAIHb5v4+Qdh6NYori+OpSQgnwRUZBWFgXCYdzTUIQUXZeglMq/LCbYB\r\nks+cPg89pD+StJvGd4P7pJV0BZSyWEaLlCroGSqDlkPhdr0dCcpwvhOKY0IN\r\nZmXWUyWu1jJCxMY/83gGTY8Z9RT+yqGsAEu6Cm5h/2odG5YnfytIr1HApZPA\r\nptWEiIP1NmCSBzsBw/OeTNl0F0z1fJzW7Z3Y83tijGubjvRY/AwHxgQQAJaj\r\nAfLVIZO3TdiZ/6ujl7ib1+mIETU40989HoV7bJXib080/g2ODKobRbucE68o\r\nBv4Dcm6r27YY+vCr8S73CkG5qd6ujhNrioR+ceHACjkqhdp8v6lfXHjAT8tZ\r\nnnjLxYfUVD4+A+veu8yWx6A8sumQaJG8zWk=\r\n=dktE\r\n-----END PGP SIGNATURE-----\r\n"},"_npmUser":{"name":"rawnly","email":"fedevitale99@gmail.com"},"directories":{},"maintainers":[{"name":"filippo.cozzini","email":"filippo.cozzini@aquacloud.it"},{"name":"rawnly","email":"fedevitale99@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/axios-jwt_0.0.3-alpha.6_1669133425189_0.31843873539174794"},"_hasShrinkwrap":false},"0.0.3":{"name":"@aquacloud/axios-jwt","version":"0.0.3","description":"Handle rotating tokens without pain","main":"build/index.js","types":"build/index.d.ts","license":"MIT","author":{"name":"Federico Vitale","email":"federico.vitale@aquacloud.it"},"keywords":["api","jwt","auth","refresh","axios"],"contributors":[{"name":"rawnly"}],"scripts":{"coverage":"vitest run -c ./config/vitest.config.ts --coverage","test":"vitest -c ./config/vitest.config.ts","build":"tsup src --config ./config/tsup.config.ts","lint-fix":"eslint src/**/*.ts --fix","lint":"eslint src/**/*.ts","dev":"tsup src --watch --config ./config/tsup.config.ts","prepublishOnly":"pnpm build"},"exports":{".":{"default":"./build/index.js","import":"./build/index.mjs","types":"./build/index.d.ts"},"./adapaters/*":{"import":"./build/adapters/*.js","default":"./build/adapters/*.js","types":"./build/adapters/*.d.ts"},"./adapters":{"import":"./build/adapters/index.js","default":"./build/adapters/index.js","types":"./build/adapters/index.d.ts"}},"devDependencies":{"@types/jsonwebtoken":"^8.5.9","@types/ms":"^0.7.31","@types/node":"^18.11.9","@typescript-eslint/eslint-plugin":"^5.42.0","@typescript-eslint/parser":"^5.42.0","@vitest/coverage-c8":"^0.24.5","@vitest/ui":"^0.24.5","axios":"^1.1.3","eslint":"^8.26.0","eslint-config-prettier":"^8.5.0","eslint-import-resolver-typescript":"^3.5.2","eslint-plugin-import":"^2.26.0","eslint-plugin-unused-imports":"^2.0.0","jsonwebtoken":"^8.5.1","prettier":"^2.7.1","tsup":"^6.3.0","turbo":"^1.6.3","typescript":"^4.8.4","vite-tsconfig-paths":"^3.5.2","vitest":"^0.24.5"},"peerDependencies":{"axios":"^1.1.3"},"dependencies":{"jwt-decode":"^3.1.2","ms":"^2.1.3"},"gitHead":"7a9a5a9b0cdb00ec2a81cfa92e2cf7bb74b44071","_id":"@aquacloud/axios-jwt@0.0.3","_nodeVersion":"16.15.1","_npmVersion":"8.11.0","dist":{"integrity":"sha512-EVTtBb+76n/ObLvz9LNyUfdQ5CjQ46NNmbrH8RBAw/X+qosD6G8G3V3I67dBPs2DN/KiHE45zwcNuL/8QBDolg==","shasum":"4795f5976728526c44cb04d8a805d6c201fce5e2","tarball":"https://registry.npmjs.org/@aquacloud/axios-jwt/-/axios-jwt-0.0.3.tgz","fileCount":32,"unpackedSize":32284,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIFv+RFP42kP+J5mz5p/MpYUsnQ4+AopGtbGn/Vo7fykXAiALZUw4+633CK+MkrTdoGh6+bgqiBAj5WR2Cy3JQem5qA=="}],"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjfPUQACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmr3Ow//ZTLTrwsk5Nk3Z5aj24qisgkam58SgmhV1ZBuEP1nb3VQ3nZy\r\n86hLRHUdjg707km4MzYWDV2J/B6OVb1L2zKMsYYOEPFo372b0YVPF3DZeZMp\r\n1dyGLUSr2sNNkJMkmZKey6uNIsrG0b2yAjPqj7VihSGehbXQw0uzPTtlcXFk\r\nOa03yNtpdqBPZANscy0s+D58u31J17bMhN2ffhFnrMLv7jDr8UP46bPS5Pyj\r\ncWtVa2PGx5UxV/mwnnDRgL4xahoZskW+VvoceCYFof7+PAvcIzJKMAkFWQ9B\r\ncmWB/ggAGfvUS0y44IuLalKYLg1zDbDSFKW0qULB0KlY+8DRWsP55ZYFqlSK\r\nMs3bHWvCMeuI8EwRNz2JbIzyYXoaVw3S7YLi7Rl6m/ZZiaJwDg2T8Hmo5RVW\r\nr0vu466HqJk2ClHaEuNl6qA1XsyQc2mJqM0KkVPrUPM+MhwG6pJHzuUTZoMk\r\ntkEV19L6fNjMD6xg8lXj1+LZmrWpqAnBqlO9QB82aGDbveqwJgddUn6iQfuV\r\n8Nkm+Djl9xVcZURNx6FB+XiD+Ji5Up1vQzzaH3HYYMsVgoKPhvvvpTfpe6J6\r\nM7f+2gWFo2RONunjfG5laIjRzS9FDqwgCyCYhuz9oRxjko3qRJggjTe+s62+\r\nekXsUt5IguHjfbXpOYGC7hwp3sESwIgFzwM=\r\n=OU2q\r\n-----END PGP SIGNATURE-----\r\n"},"_npmUser":{"name":"rawnly","email":"fedevitale99@gmail.com"},"directories":{},"maintainers":[{"name":"filippo.cozzini","email":"filippo.cozzini@aquacloud.it"},{"name":"rawnly","email":"fedevitale99@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/axios-jwt_0.0.3_1669133584442_0.9663366724658353"},"_hasShrinkwrap":false}},"time":{"created":"2022-11-17T15:26:34.111Z","0.0.1":"2022-11-17T15:26:34.389Z","modified":"2022-11-22T16:13:04.817Z","0.0.2":"2022-11-22T12:54:35.001Z","0.0.3-alpha":"2022-11-22T13:01:21.277Z","0.0.3-alpha.2":"2022-11-22T13:06:17.368Z","0.0.3-alpha.3":"2022-11-22T13:09:19.685Z","0.0.3-alpha.5":"2022-11-22T16:06:17.387Z","0.0.3-alpha.6":"2022-11-22T16:10:25.355Z","0.0.3":"2022-11-22T16:13:04.696Z"},"maintainers":[{"name":"filippo.cozzini","email":"filippo.cozzini@aquacloud.it"},{"name":"rawnly","email":"fedevitale99@gmail.com"}],"description":"Handle rotating tokens without pain","keywords":["api","jwt","auth","refresh","axios"],"contributors":[{"name":"rawnly"}],"author":{"name":"Federico Vitale","email":"federico.vitale@aquacloud.it"},"license":"MIT","readme":"# Axios JWT\n\n> A porting of the original `jetbridge/axios-jwt` with support to custom storage and ssr.\n\n## Installation\n\n```sh\n  npm install @aquacloud/axios-jwt\n```\n\n## Usage\n\n```ts\n// api.ts\n\nimport AxiosJwt, { type RequestRefresh } from \"@aquacloud/axios-jwt\";\nimport CookieStorage from \"@aquacloud/axios-jwt/adapters/cookie-storage\";\nimport axios from \"axios\";\n\n// Create an axios instance\nexport const api = axios.create({ baseURL: \"http://localhost:8080/api\" });\n\nconst requestRefresh: RequestRefresh = async (tokens: Tokens) => {\n    // DO NOT USE THE `api` INSTANCE\n    const response = await axios.post(\"http://localhost:3000\", tokens, {\n        headers: {\n            Authorization: `Bearer ${tokens.accessToken}`,\n        },\n    });\n\n    return response.data;\n};\n\n// Initialize the class\nexport const tokenInterceptor = new AxiosJwt({\n    requestRefresh,\n    // just an object that implements the web Storage interface\n    storage: new CookieStorage(), // or window.localStorage, window.sessionStorage\n    options: {\n        header: \"Authorization\",\n        headerPrefix: \"Bearer \", // NOTE: must include the space\n        // Value can be number (milliseconds) or string (see more at https://github.com/vercel/ms)\n        leeway: \"10s\",\n    },\n});\n\n// Apply the interceptor\ntokenInterceptor.apply(api);\n\n// or apply manually\napi.interceptors.request.use(tokenInterceptor.interceptor);\n```\n\n## Login / Logout\n\n```ts\n// auth.ts\n\nimport { tokenInterceptor, api } from \"./api\";\n\nconst login = async (username: string, password: string) => {\n    const response = await api.post(\"/auth/sign-in\", { username, password });\n\n    tokenInterceptor.accessToken = response.data.accessToken;\n    tokenInterceptor.refreshToken = response.data.refreshToken;\n\n    // or\n    tokenInterceptor.tokens = response.data;\n};\n```\n\nThe following example is a simple react implementation. It can be used with any framework.\n\n```tsx\n// Profile.tsx\nimport { useState } from \"react\";\nimport { api } from \"./api\";\n\nfunction Profile() {\n    const [user, setUser] = useState(null);\n\n    useEffect(() => {\n        api.get(\"/users/me\").then(response => setUser(response.data));\n    }, []);\n\n    if (!tokenInterceptor.isLoggedIn || !user) return null;\n\n    return (\n        <div>\n            {user.firstName} {user.lastName}\n        </div>\n    );\n}\n```\n\n## Utilities\n\n```ts\nimport { tokenInterceptor } from \"./api\";\n\ntokenInterceptor.isLoggedIn; // check if is logged in\ntokenInterceptor.accessToken; // read-write accessToken\ntokenInterceptor.refreshToken; // read-write refreshToken\ntokenInterceptor.clearTokens(); // sets `accessToken` and `refreshToken` to undefined\n```\n","readmeFilename":"README.md"}