websanova / vue-auth

A simple light-weight authentication library for Vue.js
MIT License
2.36k stars 380 forks source link

Support pinia for vue 3 #685

Closed tachibana-shin closed 2 years ago

tachibana-shin commented 2 years ago

Hello,

The official version of vue 3 has announced the official removal of vuex and replacement with pinia will you be able to update the library to use pinia instead of vuex?

zorn-v commented 2 years ago

This library does not use vuex or any other "state lib over vue". In your own project you can do anything what you want.

tachibana-shin commented 2 years ago

Thank you for your reply. But it doesn't seem like this library meets my needs anymore with vue 3 &typescript so I created the new plugin: vue-auth3.js.org

とにかく胡坐等ござい松

zorn-v commented 2 years ago

Maybe you miss v3.js ? https://github.com/websanova/vue-auth/blob/master/src/v3.js

Also you can use axios/frisbee/anyting you want via custom http driver. What problems your vue-auth3 package resolves ?

tachibana-shin commented 2 years ago

I need the application to store user-data in and refresh in the background. it's pointless to be blocked for trying to get authentication information

tachibana-shin commented 2 years ago

I also need a highly introspective composition API such as well useUser<UserData>() is ComputedRef<UserData>

zorn-v commented 2 years ago

I need the application to store user-data in and refresh in the background

And what problems with it ?

I also need a highly introspective composition API such as well useUser() is ComputedRef

Well, UserData is not deterministic, and should be defined in your app. Why not use some thin "wrapper" instead of creating lib ?

tachibana-shin commented 2 years ago

I'm using it for an Android app. I can't wait for 2 requests to be processed when starting the application. It's too slow. So I had to create another plug-in to enable efficient caching of logged-in user information. It's like when you open YouTube offline, and you'll still see your account there.

zorn-v commented 2 years ago

I see now. Anyway you can disable all refresh user features, and get/set user information from JWT token for example. But agree, seems it not simple as it seems. Like check JWT token sign and call something like $auth.user(decodedToken) on every load etc. Also you can implement you own storage if cookie/localStorage/sessionStorage not feet your needs.