@ollaid/native-sso 1.0.8 → 2.1.2
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 +247 -58
- package/dist/hooks/useLogout.d.ts +41 -0
- package/dist/hooks/useTokenHealthCheck.d.ts +11 -5
- package/dist/index.cjs +150 -44
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +3 -1
- package/dist/index.js +150 -44
- package/dist/index.js.map +1 -1
- package/dist/services/api.d.ts +26 -0
- package/dist/services/nativeAuth.d.ts +1 -1
- package/dist/types/native.d.ts +5 -3
- package/package.json +1 -1
package/dist/services/api.d.ts
CHANGED
|
@@ -39,10 +39,36 @@ declare const STORAGE: {
|
|
|
39
39
|
readonly USER: "user";
|
|
40
40
|
readonly ACCOUNT_TYPE: "account_type";
|
|
41
41
|
readonly ALIAS_REFERENCE: "alias_reference";
|
|
42
|
+
readonly APP_ACCESS_TOKEN_REF: "app_access_token_ref";
|
|
42
43
|
};
|
|
43
44
|
export declare const setAuthToken: (token: string) => void;
|
|
44
45
|
export declare const getAuthToken: () => string | null;
|
|
46
|
+
/**
|
|
47
|
+
* @deprecated Utilisez `logout()` à la place. `clearAuthToken()` ne fait que nettoyer
|
|
48
|
+
* le localStorage sans révoquer les sessions côté SaaS et IAM, ce qui laisse des
|
|
49
|
+
* sessions orphelines actives. `logout()` garantit la double revocation complète.
|
|
50
|
+
*/
|
|
45
51
|
export declare const clearAuthToken: () => void;
|
|
52
|
+
/**
|
|
53
|
+
* Déconnexion complète et sécurisée.
|
|
54
|
+
*
|
|
55
|
+
* Effectue la double revocation (SaaS + IAM) puis nettoie le localStorage.
|
|
56
|
+
* **Toute déconnexion frontend DOIT passer par cette fonction** pour éviter
|
|
57
|
+
* les sessions orphelines sur l'IAM.
|
|
58
|
+
*
|
|
59
|
+
* @example
|
|
60
|
+
* ```tsx
|
|
61
|
+
* import { logout } from '@ollaid/native-sso';
|
|
62
|
+
*
|
|
63
|
+
* const handleLogout = async () => {
|
|
64
|
+
* await logout();
|
|
65
|
+
* navigate('/auth/login');
|
|
66
|
+
* };
|
|
67
|
+
* ```
|
|
68
|
+
*/
|
|
69
|
+
export declare const logout: () => Promise<{
|
|
70
|
+
success: boolean;
|
|
71
|
+
}>;
|
|
46
72
|
export declare const setAuthUser: (user: unknown) => void;
|
|
47
73
|
export declare const getAuthUser: <T>() => T | null;
|
|
48
74
|
export declare const setAccountType: (type: string) => void;
|
|
@@ -25,7 +25,7 @@ export declare const nativeAuthService: {
|
|
|
25
25
|
exchange(callbackToken: string): Promise<NativeExchangeResponse>;
|
|
26
26
|
checkToken(token: string): Promise<{
|
|
27
27
|
valid: boolean;
|
|
28
|
-
|
|
28
|
+
user?: import("../types/native").UserInfos;
|
|
29
29
|
}>;
|
|
30
30
|
logout(token?: string): Promise<{
|
|
31
31
|
success: boolean;
|
package/dist/types/native.d.ts
CHANGED
|
@@ -156,11 +156,13 @@ export interface NativeExchangeResponse {
|
|
|
156
156
|
user_infos?: UserInfos;
|
|
157
157
|
/** Alias reference retournée au niveau racine par certains backends SaaS */
|
|
158
158
|
alias_reference?: string;
|
|
159
|
+
/** Référence AppAccessToken IAM liée au token Sanctum (pour revocation rapide) */
|
|
160
|
+
app_access_token_ref?: string;
|
|
159
161
|
}
|
|
160
162
|
export interface CheckTokenResponse {
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
163
|
+
status?: string;
|
|
164
|
+
success?: boolean;
|
|
165
|
+
user?: UserInfos;
|
|
164
166
|
}
|
|
165
167
|
export interface NativeAuthState {
|
|
166
168
|
credentialsLoaded: boolean;
|