@bagelink/auth 1.6.53 → 1.6.61
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 +284 -219
- package/dist/Callback-BHqVaZZm.cjs +4 -0
- package/dist/Callback-C-XghN_z.js +4 -0
- package/dist/ForgotPasswordPage-BV9tyhHl.cjs +4 -0
- package/dist/ForgotPasswordPage-DvttMGb0.js +4 -0
- package/dist/LoginPage-hv1wc54S.cjs +4 -0
- package/dist/LoginPage-klj1NV4J.js +4 -0
- package/dist/ResetPasswordPage-COPrJmW8.cjs +4 -0
- package/dist/ResetPasswordPage-nvQ4uupb.js +4 -0
- package/dist/SignupPage-m36w9PLJ.cjs +4 -0
- package/dist/SignupPage-oUFYApYW.js +4 -0
- package/dist/api.d.ts +115 -0
- package/dist/components/auth/ForgotPasswordForm.vue.d.ts +23 -0
- package/dist/components/auth/LoginForm.vue.d.ts +58 -0
- package/dist/components/auth/ResetPasswordForm.vue.d.ts +28 -0
- package/dist/components/auth/SignupForm.vue.d.ts +34 -0
- package/dist/components/index.d.ts +4 -0
- package/dist/constants.d.ts +34 -0
- package/dist/index.cjs +1227 -30
- package/dist/index.d.ts +16 -631
- package/dist/index.mjs +1242 -24
- package/dist/pages/Callback.vue.d.ts +2 -0
- package/dist/pages/ForgotPasswordPage.vue.d.ts +13 -0
- package/dist/pages/LoginPage.vue.d.ts +38 -0
- package/dist/pages/ResetPasswordPage.vue.d.ts +13 -0
- package/dist/pages/SignupPage.vue.d.ts +16 -0
- package/dist/routes.d.ts +49 -0
- package/dist/sso.d.ts +145 -0
- package/dist/types/index.d.ts +41 -0
- package/dist/types.d.ts +254 -0
- package/dist/useAuth.d.ts +112 -0
- package/dist/utils.d.ts +11 -0
- package/package.json +11 -13
- package/src/components/auth/ForgotPasswordForm.vue +97 -0
- package/src/components/auth/LoginForm.vue +257 -0
- package/src/components/auth/ResetPasswordForm.vue +146 -0
- package/src/components/auth/SignupForm.vue +224 -0
- package/src/components/index.ts +5 -0
- package/src/constants.ts +10 -0
- package/src/index.ts +26 -1
- package/src/pages/Callback.vue +183 -0
- package/src/pages/ForgotPasswordPage.vue +42 -0
- package/src/pages/LoginPage.vue +68 -0
- package/src/pages/ResetPasswordPage.vue +47 -0
- package/src/pages/SignupPage.vue +46 -0
- package/src/routes.ts +122 -0
- package/src/types/index.ts +45 -0
- package/dist/index.d.cts +0 -631
- package/dist/index.d.mts +0 -631
package/dist/index.d.ts
CHANGED
|
@@ -1,631 +1,16 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
interface AuthEventMap {
|
|
18
|
-
[AuthState.LOGIN]: AuthEventHandler;
|
|
19
|
-
[AuthState.LOGOUT]: AuthEventHandler;
|
|
20
|
-
[AuthState.SIGNUP]: AuthEventHandler;
|
|
21
|
-
[AuthState.PASSWORD_RESET]: AuthEventHandler;
|
|
22
|
-
[AuthState.PASSWORD_CHANGE]: AuthEventHandler;
|
|
23
|
-
[AuthState.PROFILE_UPDATE]: AuthEventHandler;
|
|
24
|
-
[AuthState.AUTH_CHECK]: AuthEventHandler;
|
|
25
|
-
[AuthState.EMAIL_VERIFIED]: AuthEventHandler;
|
|
26
|
-
[AuthState.SESSION_REFRESH]: AuthEventHandler;
|
|
27
|
-
}
|
|
28
|
-
type AuthenticationAccountType = 'person' | 'entity' | 'service';
|
|
29
|
-
type AuthenticationMethodType = 'password' | 'email_token' | 'sso' | 'otp';
|
|
30
|
-
type SSOProvider = 'google' | 'microsoft' | 'github' | 'okta' | 'apple' | 'facebook';
|
|
31
|
-
interface AuthenticationAccount {
|
|
32
|
-
created_at?: string;
|
|
33
|
-
updated_at?: string;
|
|
34
|
-
account_type?: AuthenticationAccountType;
|
|
35
|
-
person_id?: string;
|
|
36
|
-
entity_id?: string;
|
|
37
|
-
display_name?: string;
|
|
38
|
-
is_active?: boolean;
|
|
39
|
-
is_verified?: boolean;
|
|
40
|
-
account_metadata?: string;
|
|
41
|
-
last_login_at?: string;
|
|
42
|
-
failed_login_attempts?: number;
|
|
43
|
-
locked_until?: string;
|
|
44
|
-
id: string;
|
|
45
|
-
}
|
|
46
|
-
interface PersonInfo {
|
|
47
|
-
id: string;
|
|
48
|
-
name: string;
|
|
49
|
-
email?: string;
|
|
50
|
-
phone?: string;
|
|
51
|
-
roles: string[];
|
|
52
|
-
first_name: string;
|
|
53
|
-
last_name: string;
|
|
54
|
-
}
|
|
55
|
-
interface AuthMethodInfo {
|
|
56
|
-
id: string;
|
|
57
|
-
type: string;
|
|
58
|
-
identifier?: string;
|
|
59
|
-
is_verified: boolean;
|
|
60
|
-
last_used?: string;
|
|
61
|
-
use_count: number;
|
|
62
|
-
provider?: SSOProvider;
|
|
63
|
-
provider_user_id?: string;
|
|
64
|
-
}
|
|
65
|
-
interface AccountInfo {
|
|
66
|
-
id: string;
|
|
67
|
-
account_type: string;
|
|
68
|
-
display_name: string;
|
|
69
|
-
is_active: boolean;
|
|
70
|
-
is_verified: boolean;
|
|
71
|
-
last_login?: string;
|
|
72
|
-
authentication_methods: AuthMethodInfo[];
|
|
73
|
-
person?: PersonInfo;
|
|
74
|
-
entity?: EntityInfo;
|
|
75
|
-
}
|
|
76
|
-
interface EntityInfo {
|
|
77
|
-
id: string;
|
|
78
|
-
name: string;
|
|
79
|
-
type?: string;
|
|
80
|
-
metadata?: Record<string, any>;
|
|
81
|
-
}
|
|
82
|
-
interface SessionInfo {
|
|
83
|
-
id: string;
|
|
84
|
-
created_at: string;
|
|
85
|
-
expires_at: string;
|
|
86
|
-
ip_address?: string;
|
|
87
|
-
user_agent?: string;
|
|
88
|
-
is_current?: boolean;
|
|
89
|
-
}
|
|
90
|
-
/**
|
|
91
|
-
* Unified user representation that works for both person and entity accounts
|
|
92
|
-
* This is the primary interface for accessing user data in the application
|
|
93
|
-
*/
|
|
94
|
-
interface User {
|
|
95
|
-
/** Unique identifier (person_id or entity_id) */
|
|
96
|
-
id: string;
|
|
97
|
-
/** Account ID */
|
|
98
|
-
accountId: string;
|
|
99
|
-
/** Display name */
|
|
100
|
-
name: string;
|
|
101
|
-
/** Email address (from person or authentication methods) */
|
|
102
|
-
email?: string;
|
|
103
|
-
/** Account type: 'person', 'entity', or 'service' */
|
|
104
|
-
type: AuthenticationAccountType;
|
|
105
|
-
/** User roles (only for person accounts) */
|
|
106
|
-
roles?: string[];
|
|
107
|
-
/** Is the account active */
|
|
108
|
-
isActive: boolean;
|
|
109
|
-
/** Is the account verified */
|
|
110
|
-
isVerified: boolean;
|
|
111
|
-
/** Last login timestamp */
|
|
112
|
-
lastLogin?: string;
|
|
113
|
-
/** Entity-specific info (only for entity accounts) */
|
|
114
|
-
entityType?: string;
|
|
115
|
-
/** Additional metadata */
|
|
116
|
-
metadata?: Record<string, any>;
|
|
117
|
-
/** Person-specific info (only for person accounts) */
|
|
118
|
-
person?: PersonInfo;
|
|
119
|
-
}
|
|
120
|
-
interface RegisterRequest {
|
|
121
|
-
email: string;
|
|
122
|
-
first_name: string;
|
|
123
|
-
last_name: string;
|
|
124
|
-
phone_number?: string;
|
|
125
|
-
password?: string;
|
|
126
|
-
}
|
|
127
|
-
interface UpdateAccountRequest {
|
|
128
|
-
first_name?: string;
|
|
129
|
-
last_name?: string;
|
|
130
|
-
email?: string;
|
|
131
|
-
phone_number?: string;
|
|
132
|
-
}
|
|
133
|
-
interface PasswordLoginRequest {
|
|
134
|
-
email: string;
|
|
135
|
-
password: string;
|
|
136
|
-
}
|
|
137
|
-
interface ChangePasswordRequest {
|
|
138
|
-
current_password: string;
|
|
139
|
-
new_password: string;
|
|
140
|
-
}
|
|
141
|
-
interface ForgotPasswordRequest {
|
|
142
|
-
email: string;
|
|
143
|
-
}
|
|
144
|
-
interface ResetPasswordRequest {
|
|
145
|
-
token: string;
|
|
146
|
-
new_password: string;
|
|
147
|
-
}
|
|
148
|
-
interface SendVerificationRequest {
|
|
149
|
-
email?: string;
|
|
150
|
-
}
|
|
151
|
-
interface VerifyEmailRequest {
|
|
152
|
-
token: string;
|
|
153
|
-
}
|
|
154
|
-
interface NewUser extends RegisterRequest {
|
|
155
|
-
confirmPassword: string;
|
|
156
|
-
}
|
|
157
|
-
interface UpdatePasswordForm extends ChangePasswordRequest {
|
|
158
|
-
confirmNewPassword: string;
|
|
159
|
-
}
|
|
160
|
-
interface MessageResponse {
|
|
161
|
-
message: string;
|
|
162
|
-
}
|
|
163
|
-
interface AuthStatusResponse {
|
|
164
|
-
status: string;
|
|
165
|
-
methods: string[];
|
|
166
|
-
}
|
|
167
|
-
interface AvailableMethodsResponse {
|
|
168
|
-
available_methods: {
|
|
169
|
-
[key: string]: any;
|
|
170
|
-
}[];
|
|
171
|
-
}
|
|
172
|
-
interface OTPMetadata {
|
|
173
|
-
nonce: string;
|
|
174
|
-
verification_hash: string;
|
|
175
|
-
timestamp: number;
|
|
176
|
-
expires_in_minutes: number;
|
|
177
|
-
autofill: {
|
|
178
|
-
[key: string]: any;
|
|
179
|
-
};
|
|
180
|
-
}
|
|
181
|
-
interface SSOMetadata {
|
|
182
|
-
provider: SSOProvider;
|
|
183
|
-
sso_user_info: {
|
|
184
|
-
[key: string]: any;
|
|
185
|
-
};
|
|
186
|
-
can_create_account?: boolean;
|
|
187
|
-
}
|
|
188
|
-
interface SSOInitiateRequest {
|
|
189
|
-
provider: SSOProvider;
|
|
190
|
-
redirect_uri?: string;
|
|
191
|
-
state?: string;
|
|
192
|
-
scopes?: string[];
|
|
193
|
-
params?: Record<string, string>;
|
|
194
|
-
code_challenge?: string;
|
|
195
|
-
code_challenge_method?: 'S256' | 'plain';
|
|
196
|
-
}
|
|
197
|
-
interface SSOCallbackRequest {
|
|
198
|
-
provider: SSOProvider;
|
|
199
|
-
code: string;
|
|
200
|
-
state?: string;
|
|
201
|
-
}
|
|
202
|
-
interface SSOLinkRequest {
|
|
203
|
-
provider: SSOProvider;
|
|
204
|
-
code: string;
|
|
205
|
-
state: string;
|
|
206
|
-
}
|
|
207
|
-
interface SSOUnlinkRequest {
|
|
208
|
-
provider: SSOProvider;
|
|
209
|
-
}
|
|
210
|
-
interface AuthenticationResponse {
|
|
211
|
-
success: boolean;
|
|
212
|
-
account_id?: string;
|
|
213
|
-
session_token?: string;
|
|
214
|
-
requires_verification?: boolean;
|
|
215
|
-
verification_method?: AuthenticationMethodType;
|
|
216
|
-
message?: string;
|
|
217
|
-
metadata?: OTPMetadata | SSOMetadata | {
|
|
218
|
-
[key: string]: any;
|
|
219
|
-
};
|
|
220
|
-
}
|
|
221
|
-
interface SessionListResponse {
|
|
222
|
-
account_id: string;
|
|
223
|
-
sessions: SessionInfo[];
|
|
224
|
-
}
|
|
225
|
-
type LoginResponse = AxiosResponse<AuthenticationResponse>;
|
|
226
|
-
type RegisterResponse = AxiosResponse<AuthenticationResponse>;
|
|
227
|
-
type LogoutResponse = AxiosResponse<MessageResponse>;
|
|
228
|
-
type GetMeResponse = AxiosResponse<AccountInfo>;
|
|
229
|
-
type UpdateMeResponse = AxiosResponse<AccountInfo>;
|
|
230
|
-
type DeleteMeResponse = AxiosResponse<MessageResponse>;
|
|
231
|
-
type GetAccountResponse = AxiosResponse<AccountInfo>;
|
|
232
|
-
type UpdateAccountResponse = AxiosResponse<AccountInfo>;
|
|
233
|
-
type DeleteAccountResponse = AxiosResponse<MessageResponse>;
|
|
234
|
-
type ActivateAccountResponse = AxiosResponse<AccountInfo>;
|
|
235
|
-
type DeactivateAccountResponse = AxiosResponse<AccountInfo>;
|
|
236
|
-
type ChangePasswordResponse = AxiosResponse<MessageResponse>;
|
|
237
|
-
type ForgotPasswordResponse = AxiosResponse<MessageResponse>;
|
|
238
|
-
type ResetPasswordResponse = AxiosResponse<MessageResponse>;
|
|
239
|
-
type VerifyResetTokenResponse = AxiosResponse<MessageResponse>;
|
|
240
|
-
type SendVerificationResponse = AxiosResponse<MessageResponse>;
|
|
241
|
-
type VerifyEmailResponse = AxiosResponse<MessageResponse>;
|
|
242
|
-
type RefreshSessionResponse = AxiosResponse<AuthenticationResponse>;
|
|
243
|
-
type GetSessionsResponse = AxiosResponse<SessionListResponse>;
|
|
244
|
-
type DeleteSessionResponse = AxiosResponse<MessageResponse>;
|
|
245
|
-
type DeleteAllSessionsResponse = AxiosResponse<MessageResponse>;
|
|
246
|
-
type CleanupSessionsResponse = AxiosResponse<MessageResponse>;
|
|
247
|
-
type GetMethodsResponse = AxiosResponse<AvailableMethodsResponse>;
|
|
248
|
-
type SSOInitiateResponse = AxiosResponse<{
|
|
249
|
-
authorization_url: string;
|
|
250
|
-
}>;
|
|
251
|
-
type SSOCallbackResponse = AxiosResponse<AuthenticationResponse>;
|
|
252
|
-
type SSOLinkResponse = AxiosResponse<MessageResponse>;
|
|
253
|
-
type SSOUnlinkResponse = AxiosResponse<MessageResponse>;
|
|
254
|
-
/**
|
|
255
|
-
* Extract unified user from account info
|
|
256
|
-
*/
|
|
257
|
-
declare function accountToUser(account: AccountInfo | null): User | null;
|
|
258
|
-
|
|
259
|
-
declare class AuthApi {
|
|
260
|
-
private api;
|
|
261
|
-
constructor(baseURL?: string);
|
|
262
|
-
private setupInterceptors;
|
|
263
|
-
/**
|
|
264
|
-
* Get available authentication methods
|
|
265
|
-
*/
|
|
266
|
-
getAuthMethods(): Promise<GetMethodsResponse>;
|
|
267
|
-
/**
|
|
268
|
-
* Register a new account
|
|
269
|
-
*/
|
|
270
|
-
register(data: RegisterRequest): Promise<RegisterResponse>;
|
|
271
|
-
/**
|
|
272
|
-
* Login with password
|
|
273
|
-
*/
|
|
274
|
-
login(email: string, password: string): Promise<LoginResponse>;
|
|
275
|
-
/**
|
|
276
|
-
* Logout and clear session
|
|
277
|
-
*/
|
|
278
|
-
logout(): Promise<LogoutResponse>;
|
|
279
|
-
/**
|
|
280
|
-
* Refresh current session
|
|
281
|
-
*/
|
|
282
|
-
refreshSession(): Promise<RefreshSessionResponse>;
|
|
283
|
-
/**
|
|
284
|
-
* Initiate SSO login flow
|
|
285
|
-
* Returns authorization URL to redirect user to
|
|
286
|
-
*/
|
|
287
|
-
initiateSSO(data: SSOInitiateRequest): Promise<SSOInitiateResponse>;
|
|
288
|
-
/**
|
|
289
|
-
* Complete SSO login after callback from provider
|
|
290
|
-
*/
|
|
291
|
-
ssoCallback(data: SSOCallbackRequest): Promise<SSOCallbackResponse>;
|
|
292
|
-
/**
|
|
293
|
-
* Link an SSO provider to existing account
|
|
294
|
-
*/
|
|
295
|
-
linkSSOProvider(data: SSOLinkRequest): Promise<SSOLinkResponse>;
|
|
296
|
-
/**
|
|
297
|
-
* Unlink an SSO provider from account
|
|
298
|
-
*/
|
|
299
|
-
unlinkSSOProvider(provider: SSOProvider): Promise<SSOUnlinkResponse>;
|
|
300
|
-
/**
|
|
301
|
-
* Get current user account info
|
|
302
|
-
*/
|
|
303
|
-
getCurrentUser(): Promise<GetMeResponse>;
|
|
304
|
-
/**
|
|
305
|
-
* Update current user profile
|
|
306
|
-
*/
|
|
307
|
-
updateCurrentUser(data: UpdateAccountRequest): Promise<UpdateMeResponse>;
|
|
308
|
-
/**
|
|
309
|
-
* Delete current user account
|
|
310
|
-
*/
|
|
311
|
-
deleteCurrentUser(): Promise<DeleteMeResponse>;
|
|
312
|
-
/**
|
|
313
|
-
* Get account information by ID
|
|
314
|
-
*/
|
|
315
|
-
getAccount(accountId: string): Promise<GetAccountResponse>;
|
|
316
|
-
/**
|
|
317
|
-
* Update account by ID
|
|
318
|
-
*/
|
|
319
|
-
updateAccount(accountId: string, data: UpdateAccountRequest): Promise<UpdateAccountResponse>;
|
|
320
|
-
/**
|
|
321
|
-
* Delete account by ID
|
|
322
|
-
*/
|
|
323
|
-
deleteAccount(accountId: string): Promise<DeleteAccountResponse>;
|
|
324
|
-
/**
|
|
325
|
-
* Activate account by ID
|
|
326
|
-
*/
|
|
327
|
-
activateAccount(accountId: string): Promise<ActivateAccountResponse>;
|
|
328
|
-
/**
|
|
329
|
-
* Deactivate account by ID
|
|
330
|
-
*/
|
|
331
|
-
deactivateAccount(accountId: string): Promise<DeactivateAccountResponse>;
|
|
332
|
-
/**
|
|
333
|
-
* Change password (requires current password)
|
|
334
|
-
*/
|
|
335
|
-
changePassword(data: ChangePasswordRequest): Promise<ChangePasswordResponse>;
|
|
336
|
-
/**
|
|
337
|
-
* Initiate forgot password flow
|
|
338
|
-
*/
|
|
339
|
-
forgotPassword(email: string): Promise<ForgotPasswordResponse>;
|
|
340
|
-
/**
|
|
341
|
-
* Verify password reset token
|
|
342
|
-
*/
|
|
343
|
-
verifyResetToken(token: string): Promise<VerifyResetTokenResponse>;
|
|
344
|
-
/**
|
|
345
|
-
* Reset password with token
|
|
346
|
-
*/
|
|
347
|
-
resetPassword(data: ResetPasswordRequest): Promise<ResetPasswordResponse>;
|
|
348
|
-
/**
|
|
349
|
-
* Send email verification
|
|
350
|
-
*/
|
|
351
|
-
sendVerification(data?: SendVerificationRequest, user?: AuthenticationAccount): Promise<SendVerificationResponse>;
|
|
352
|
-
/**
|
|
353
|
-
* Verify email with token
|
|
354
|
-
*/
|
|
355
|
-
verifyEmail(token: string): Promise<VerifyEmailResponse>;
|
|
356
|
-
/**
|
|
357
|
-
* Get sessions for an account
|
|
358
|
-
*/
|
|
359
|
-
getSessions(accountId: string): Promise<GetSessionsResponse>;
|
|
360
|
-
/**
|
|
361
|
-
* Revoke a specific session
|
|
362
|
-
*/
|
|
363
|
-
revokeSession(sessionToken: string): Promise<DeleteSessionResponse>;
|
|
364
|
-
/**
|
|
365
|
-
* Revoke all sessions for an account
|
|
366
|
-
*/
|
|
367
|
-
revokeAllSessions(accountId: string): Promise<DeleteAllSessionsResponse>;
|
|
368
|
-
/**
|
|
369
|
-
* Cleanup expired sessions (admin)
|
|
370
|
-
*/
|
|
371
|
-
cleanupSessions(): Promise<CleanupSessionsResponse>;
|
|
372
|
-
}
|
|
373
|
-
|
|
374
|
-
/**
|
|
375
|
-
* Set the auth context for SSO operations
|
|
376
|
-
* This is called automatically when using useAuth()
|
|
377
|
-
*/
|
|
378
|
-
declare function setAuthContext(authApi: any): void;
|
|
379
|
-
/**
|
|
380
|
-
* SSO Provider Configuration
|
|
381
|
-
*/
|
|
382
|
-
interface SSOProviderConfig {
|
|
383
|
-
/** Provider identifier */
|
|
384
|
-
id: SSOProvider;
|
|
385
|
-
/** Display name */
|
|
386
|
-
name: string;
|
|
387
|
-
/** Brand color (hex) */
|
|
388
|
-
color: string;
|
|
389
|
-
/** Icon identifier (for UI libraries) */
|
|
390
|
-
icon: string;
|
|
391
|
-
/** Default OAuth scopes */
|
|
392
|
-
defaultScopes: string[];
|
|
393
|
-
/** Provider-specific metadata */
|
|
394
|
-
metadata?: {
|
|
395
|
-
authDomain?: string;
|
|
396
|
-
buttonText?: string;
|
|
397
|
-
[key: string]: any;
|
|
398
|
-
};
|
|
399
|
-
}
|
|
400
|
-
/**
|
|
401
|
-
* OAuth Flow Options
|
|
402
|
-
*/
|
|
403
|
-
interface OAuthFlowOptions {
|
|
404
|
-
/** Custom redirect URI (defaults to current origin + /auth/callback) */
|
|
405
|
-
redirectUri?: string;
|
|
406
|
-
/** State parameter for CSRF protection (auto-generated if not provided) */
|
|
407
|
-
state?: string;
|
|
408
|
-
/** Custom scopes (overrides provider defaults) */
|
|
409
|
-
scopes?: string[];
|
|
410
|
-
/** Additional OAuth parameters (prompt, login_hint, hd, domain, etc.) */
|
|
411
|
-
params?: Record<string, string>;
|
|
412
|
-
/** Popup window dimensions */
|
|
413
|
-
popupDimensions?: {
|
|
414
|
-
width?: number;
|
|
415
|
-
height?: number;
|
|
416
|
-
};
|
|
417
|
-
/** Timeout for popup flow in milliseconds (default: 90000) */
|
|
418
|
-
popupTimeout?: number;
|
|
419
|
-
}
|
|
420
|
-
/**
|
|
421
|
-
* Popup Result
|
|
422
|
-
*/
|
|
423
|
-
interface PopupResult {
|
|
424
|
-
code: string;
|
|
425
|
-
state?: string;
|
|
426
|
-
error?: string;
|
|
427
|
-
}
|
|
428
|
-
/**
|
|
429
|
-
* SSO Error Types
|
|
430
|
-
*/
|
|
431
|
-
declare class SSOError extends Error {
|
|
432
|
-
code: string;
|
|
433
|
-
constructor(message: string, code: string);
|
|
434
|
-
}
|
|
435
|
-
declare class PopupBlockedError extends SSOError {
|
|
436
|
-
constructor();
|
|
437
|
-
}
|
|
438
|
-
declare class PopupClosedError extends SSOError {
|
|
439
|
-
constructor();
|
|
440
|
-
}
|
|
441
|
-
declare class PopupTimeoutError extends SSOError {
|
|
442
|
-
constructor();
|
|
443
|
-
}
|
|
444
|
-
declare class StateMismatchError extends SSOError {
|
|
445
|
-
constructor();
|
|
446
|
-
}
|
|
447
|
-
/**
|
|
448
|
-
* SSO Provider Instance with functional methods
|
|
449
|
-
*/
|
|
450
|
-
interface SSOProviderInstance extends SSOProviderConfig {
|
|
451
|
-
/**
|
|
452
|
-
* Initiate OAuth flow with redirect (most common)
|
|
453
|
-
* User is redirected to provider's authorization page
|
|
454
|
-
*/
|
|
455
|
-
redirect: (options?: OAuthFlowOptions) => Promise<void>;
|
|
456
|
-
/**
|
|
457
|
-
* Initiate OAuth flow in a popup window
|
|
458
|
-
* Returns the authorization code without leaving the page
|
|
459
|
-
*/
|
|
460
|
-
popup: (options?: OAuthFlowOptions) => Promise<AuthenticationResponse>;
|
|
461
|
-
/**
|
|
462
|
-
* Complete OAuth flow after callback
|
|
463
|
-
* Call this on your callback page
|
|
464
|
-
*/
|
|
465
|
-
callback: (code: string, state?: string) => Promise<AuthenticationResponse>;
|
|
466
|
-
/**
|
|
467
|
-
* Link this provider to the current logged-in user
|
|
468
|
-
* Call this after OAuth redirect completes on link callback page
|
|
469
|
-
*/
|
|
470
|
-
link: (code: string, state?: string) => Promise<void>;
|
|
471
|
-
/**
|
|
472
|
-
* Unlink this provider from the current user
|
|
473
|
-
*/
|
|
474
|
-
unlink: () => Promise<void>;
|
|
475
|
-
/**
|
|
476
|
-
* Get authorization URL without redirecting
|
|
477
|
-
*/
|
|
478
|
-
getAuthUrl: (options?: OAuthFlowOptions) => Promise<string>;
|
|
479
|
-
/**
|
|
480
|
-
* Whether this provider supports popup flow
|
|
481
|
-
* Some providers (like Apple) work better with redirect
|
|
482
|
-
*/
|
|
483
|
-
supportsPopup?: boolean;
|
|
484
|
-
}
|
|
485
|
-
/**
|
|
486
|
-
* SSO object type with providers and helper methods
|
|
487
|
-
*/
|
|
488
|
-
interface SSOObject {
|
|
489
|
-
google: SSOProviderInstance;
|
|
490
|
-
microsoft: SSOProviderInstance;
|
|
491
|
-
github: SSOProviderInstance;
|
|
492
|
-
okta: SSOProviderInstance;
|
|
493
|
-
apple: SSOProviderInstance;
|
|
494
|
-
facebook: SSOProviderInstance;
|
|
495
|
-
handleCallback: () => Promise<AuthenticationResponse | null>;
|
|
496
|
-
handleLinkCallback: () => Promise<void>;
|
|
497
|
-
}
|
|
498
|
-
/**
|
|
499
|
-
* SSO object with providers and global helper methods
|
|
500
|
-
*/
|
|
501
|
-
declare const sso: SSOObject;
|
|
502
|
-
/**
|
|
503
|
-
* Array of all SSO provider instances
|
|
504
|
-
*/
|
|
505
|
-
declare const ssoProvidersList: readonly SSOProviderInstance[];
|
|
506
|
-
/**
|
|
507
|
-
* Get SSO provider instance by ID
|
|
508
|
-
*/
|
|
509
|
-
declare function getSSOProvider(provider: SSOProvider): SSOProviderInstance | undefined;
|
|
510
|
-
/**
|
|
511
|
-
* Get all available SSO providers
|
|
512
|
-
*/
|
|
513
|
-
declare function getAllSSOProviders(): readonly SSOProviderInstance[];
|
|
514
|
-
/**
|
|
515
|
-
* Check if a provider is supported
|
|
516
|
-
*/
|
|
517
|
-
declare function isSupportedProvider(provider: string): provider is SSOProvider;
|
|
518
|
-
|
|
519
|
-
declare function initAuth({ baseURL, }: {
|
|
520
|
-
baseURL: string;
|
|
521
|
-
}): {
|
|
522
|
-
on<K extends AuthState>(event: K, handler: AuthEventMap[K]): void;
|
|
523
|
-
off<K extends AuthState>(event: K, handler: AuthEventMap[K]): void;
|
|
524
|
-
removeAllListeners<K extends AuthState>(event?: K): void;
|
|
525
|
-
install(app: App): void;
|
|
526
|
-
};
|
|
527
|
-
declare function useAuth(): {
|
|
528
|
-
user: vue.ComputedRef<User | null>;
|
|
529
|
-
accountInfo: vue.Ref<{
|
|
530
|
-
id: string;
|
|
531
|
-
account_type: string;
|
|
532
|
-
display_name: string;
|
|
533
|
-
is_active: boolean;
|
|
534
|
-
is_verified: boolean;
|
|
535
|
-
last_login?: string | undefined;
|
|
536
|
-
authentication_methods: {
|
|
537
|
-
id: string;
|
|
538
|
-
type: string;
|
|
539
|
-
identifier?: string | undefined;
|
|
540
|
-
is_verified: boolean;
|
|
541
|
-
last_used?: string | undefined;
|
|
542
|
-
use_count: number;
|
|
543
|
-
provider?: SSOProvider | undefined;
|
|
544
|
-
provider_user_id?: string | undefined;
|
|
545
|
-
}[];
|
|
546
|
-
person?: {
|
|
547
|
-
id: string;
|
|
548
|
-
name: string;
|
|
549
|
-
email?: string | undefined;
|
|
550
|
-
phone?: string | undefined;
|
|
551
|
-
roles: string[];
|
|
552
|
-
first_name: string;
|
|
553
|
-
last_name: string;
|
|
554
|
-
} | undefined;
|
|
555
|
-
entity?: {
|
|
556
|
-
id: string;
|
|
557
|
-
name: string;
|
|
558
|
-
type?: string | undefined;
|
|
559
|
-
metadata?: Record<string, any> | undefined;
|
|
560
|
-
} | undefined;
|
|
561
|
-
} | null, AccountInfo | {
|
|
562
|
-
id: string;
|
|
563
|
-
account_type: string;
|
|
564
|
-
display_name: string;
|
|
565
|
-
is_active: boolean;
|
|
566
|
-
is_verified: boolean;
|
|
567
|
-
last_login?: string | undefined;
|
|
568
|
-
authentication_methods: {
|
|
569
|
-
id: string;
|
|
570
|
-
type: string;
|
|
571
|
-
identifier?: string | undefined;
|
|
572
|
-
is_verified: boolean;
|
|
573
|
-
last_used?: string | undefined;
|
|
574
|
-
use_count: number;
|
|
575
|
-
provider?: SSOProvider | undefined;
|
|
576
|
-
provider_user_id?: string | undefined;
|
|
577
|
-
}[];
|
|
578
|
-
person?: {
|
|
579
|
-
id: string;
|
|
580
|
-
name: string;
|
|
581
|
-
email?: string | undefined;
|
|
582
|
-
phone?: string | undefined;
|
|
583
|
-
roles: string[];
|
|
584
|
-
first_name: string;
|
|
585
|
-
last_name: string;
|
|
586
|
-
} | undefined;
|
|
587
|
-
entity?: {
|
|
588
|
-
id: string;
|
|
589
|
-
name: string;
|
|
590
|
-
type?: string | undefined;
|
|
591
|
-
metadata?: Record<string, any> | undefined;
|
|
592
|
-
} | undefined;
|
|
593
|
-
} | null>;
|
|
594
|
-
sso: SSOObject;
|
|
595
|
-
getFullName: () => string;
|
|
596
|
-
getIsLoggedIn: () => boolean;
|
|
597
|
-
getEmail: () => string;
|
|
598
|
-
getRoles: () => string[];
|
|
599
|
-
getAccountType: () => AuthenticationAccountType;
|
|
600
|
-
isPersonAccount: () => boolean;
|
|
601
|
-
isEntityAccount: () => boolean;
|
|
602
|
-
login: (credentials: {
|
|
603
|
-
email: string;
|
|
604
|
-
password: string;
|
|
605
|
-
}) => Promise<AuthenticationResponse>;
|
|
606
|
-
logout: () => Promise<void>;
|
|
607
|
-
signup: (newUser: NewUser) => Promise<AuthenticationResponse>;
|
|
608
|
-
checkAuth: () => Promise<boolean>;
|
|
609
|
-
refreshSession: () => Promise<void>;
|
|
610
|
-
initiateSSO: (params: SSOInitiateRequest) => Promise<string>;
|
|
611
|
-
loginWithSSO: (params: SSOCallbackRequest) => Promise<AuthenticationResponse>;
|
|
612
|
-
linkSSOProvider: (params: SSOLinkRequest) => Promise<void>;
|
|
613
|
-
unlinkSSOProvider: (provider: SSOProvider) => Promise<void>;
|
|
614
|
-
updateProfile: (updates: UpdateAccountRequest) => Promise<void>;
|
|
615
|
-
deleteCurrentUser: () => Promise<void>;
|
|
616
|
-
changePassword: (form: UpdatePasswordForm) => Promise<void>;
|
|
617
|
-
forgotPassword: (email: string) => Promise<void>;
|
|
618
|
-
verifyResetToken: (token: string) => Promise<void>;
|
|
619
|
-
resetPassword: (token: string, newPassword: string) => Promise<void>;
|
|
620
|
-
sendVerification: (email?: string) => Promise<void>;
|
|
621
|
-
verifyEmail: (token: string) => Promise<void>;
|
|
622
|
-
activateAccount: (accountId: string) => Promise<void>;
|
|
623
|
-
deactivateAccount: (accountId: string) => Promise<void>;
|
|
624
|
-
deleteAccount: (accountId: string) => Promise<void>;
|
|
625
|
-
getSessions: (accountId?: string) => Promise<GetSessionsResponse>;
|
|
626
|
-
revokeSession: (sessionToken: string) => Promise<void>;
|
|
627
|
-
revokeAllSessions: (accountId?: string) => Promise<void>;
|
|
628
|
-
};
|
|
629
|
-
|
|
630
|
-
export { AuthApi, AuthState, PopupBlockedError, PopupClosedError, PopupTimeoutError, SSOError, StateMismatchError, accountToUser, getAllSSOProviders, getSSOProvider, initAuth, isSupportedProvider, setAuthContext, sso, ssoProvidersList, useAuth };
|
|
631
|
-
export type { AccountInfo, ActivateAccountResponse, AuthEventHandler, AuthEventMap, AuthMethodInfo, AuthStatusResponse, AuthenticationAccount, AuthenticationAccountType, AuthenticationMethodType, AuthenticationResponse, AvailableMethodsResponse, ChangePasswordRequest, ChangePasswordResponse, CleanupSessionsResponse, DeactivateAccountResponse, DeleteAccountResponse, DeleteAllSessionsResponse, DeleteMeResponse, DeleteSessionResponse, EntityInfo, ForgotPasswordRequest, ForgotPasswordResponse, GetAccountResponse, GetMeResponse, GetMethodsResponse, GetSessionsResponse, LoginResponse, LogoutResponse, MessageResponse, NewUser, OAuthFlowOptions, OTPMetadata, PasswordLoginRequest, PersonInfo, PopupResult, RefreshSessionResponse, RegisterRequest, RegisterResponse, ResetPasswordRequest, ResetPasswordResponse, SSOCallbackRequest, SSOCallbackResponse, SSOInitiateRequest, SSOInitiateResponse, SSOLinkRequest, SSOLinkResponse, SSOMetadata, SSOObject, SSOProvider, SSOProviderConfig, SSOProviderInstance, SSOUnlinkRequest, SSOUnlinkResponse, SendVerificationRequest, SendVerificationResponse, SessionInfo, SessionListResponse, UpdateAccountRequest, UpdateAccountResponse, UpdateMeResponse, UpdatePasswordForm, User, VerifyEmailRequest, VerifyEmailResponse, VerifyResetTokenResponse };
|
|
1
|
+
export * from './api';
|
|
2
|
+
export { default as ForgotPasswordForm } from './components/auth/ForgotPasswordForm.vue';
|
|
3
|
+
export { default as LoginForm } from './components/auth/LoginForm.vue';
|
|
4
|
+
export { default as ResetPasswordForm } from './components/auth/ResetPasswordForm.vue';
|
|
5
|
+
export { default as SignupForm } from './components/auth/SignupForm.vue';
|
|
6
|
+
export * from './constants';
|
|
7
|
+
export { default as Callback } from './pages/Callback.vue';
|
|
8
|
+
export { default as ForgotPasswordPage } from './pages/ForgotPasswordPage.vue';
|
|
9
|
+
export { default as LoginPage } from './pages/LoginPage.vue';
|
|
10
|
+
export { default as ResetPasswordPage } from './pages/ResetPasswordPage.vue';
|
|
11
|
+
export { default as SignupPage } from './pages/SignupPage.vue';
|
|
12
|
+
export * from './routes';
|
|
13
|
+
export * from './sso';
|
|
14
|
+
export * from './types';
|
|
15
|
+
export type { ForgotPasswordTexts, LoginTexts, ResetPasswordTexts, SignupTexts, } from './types/';
|
|
16
|
+
export * from './useAuth';
|