fge-auth-component 5.1.6 → 5.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +31 -0
- package/dist/fge-auth-component.es.js +7029 -6684
- package/dist/fge-auth-component.umd.js +19 -19
- package/dist/main.d.ts +41 -3
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -95,6 +95,37 @@ El store de pinia que contiene toda la información del usuario logueado
|
|
|
95
95
|
|
|
96
96
|
```
|
|
97
97
|
|
|
98
|
+
## Refresh token (rama ms-seguridad-v2, sin `baseUrlAuthNv`)
|
|
99
|
+
|
|
100
|
+
El store expone `onRefreshToken()` con **single-flight**: llamadas concurrentes comparten una sola petición HTTP de refresh.
|
|
101
|
+
|
|
102
|
+
### Uso recomendado en axios
|
|
103
|
+
|
|
104
|
+
```typescript
|
|
105
|
+
import axios from 'axios';
|
|
106
|
+
import { attachAuthRefreshInterceptor, useFgeAuthLoginStore } from 'fge-auth-component';
|
|
107
|
+
|
|
108
|
+
const api = axios.create({ baseURL: 'https://ms-seguridad.../api' });
|
|
109
|
+
|
|
110
|
+
api.interceptors.request.use((config) => {
|
|
111
|
+
const store = useFgeAuthLoginStore();
|
|
112
|
+
if (store.userState.token) {
|
|
113
|
+
config.headers.Authorization = `Bearer ${store.userState.token}`;
|
|
114
|
+
}
|
|
115
|
+
return config;
|
|
116
|
+
});
|
|
117
|
+
|
|
118
|
+
attachAuthRefreshInterceptor(api, {
|
|
119
|
+
onRefreshFailed: () => {
|
|
120
|
+
// logout / redirect según tu app
|
|
121
|
+
},
|
|
122
|
+
});
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
Referencia de implementación piloto: `jl2_penal_frontend/src/api/auth-refresh.interceptor.ts`.
|
|
126
|
+
|
|
127
|
+
**Nota:** Con `baseUrlAuthNv` (ms-auth) el refresh ocurre en backend vía cookies; `onRefreshToken` es no-op y no uses el interceptor legacy.
|
|
128
|
+
|
|
98
129
|
## Publicar en npm
|
|
99
130
|
|
|
100
131
|
- Cambiar version
|