axios-jwt
axios-jwt copied to clipboard
Allow a different storage.
Hello, I would like to store my credentials inside a cookie. I need them available for SSR reasons. Having the ability to specify a custom storage would be nice.
It could be done extending the existing Storage interface and adding it to the config object.
I agree that cookie support is needed. It's generally considered best practice because of HttpOnly and friends. Which I didn't know when I wrote this module.
I took a look at the code (which I contributed in the past) and I think that for such a radical change it the structure has to reviewed to be more permissive… if u’re interested I can try something in the weekend.
Sure maybe a 2.0 version would make sense
Inspired by @jetbridge, I created an http-client.js that stores, clears, transmits and automatically refresh JWT authentication tokens. Supports both localstorage and cookie storage. Check it out here
You should consider opening up a pull request :-)
Okay sure. But the issue is, I'm not familiar with TypeScript. I was searching for js/ts library that handles jwt operations without the need to do that manually and I found this awesome library with great technic of handling jwt.
What about a general Storage interface so the user can configure it as preferred from the interceptor? (Like the refresh function)
Made a PR that would allow usage of cookies as well: https://github.com/jetbridge/axios-jwt/pull/48
this one and #45 can be closed once #48 is released :)