@rebasepro/auth 0.1.2 → 0.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/LICENSE +21 -6
- package/dist/api.d.ts +10 -8
- package/dist/index.d.ts +1 -5
- package/dist/index.es.js +31 -1217
- package/dist/index.es.js.map +1 -1
- package/dist/index.umd.js +32 -1214
- package/dist/index.umd.js.map +1 -1
- package/dist/types.d.ts +13 -8
- package/package.json +10 -9
- package/src/api.ts +31 -22
- package/src/hooks/useBackendUserManagement.ts +10 -1
- package/src/hooks/useRebaseAuthController.ts +11 -16
- package/src/index.ts +1 -8
- package/src/types.ts +6 -5
- package/dist/components/AdminViews.d.ts +0 -22
- package/dist/components/RebaseAuth.d.ts +0 -6
- package/dist/components/RebaseLoginView.d.ts +0 -73
- package/src/components/AdminViews.tsx +0 -825
- package/src/components/RebaseAuth.tsx +0 -23
- package/src/components/RebaseLoginView.tsx +0 -724
package/dist/types.d.ts
CHANGED
|
@@ -4,14 +4,15 @@ import { AuthController, Role, User } from "@rebasepro/types";
|
|
|
4
4
|
* with additional methods for email/password and Google login
|
|
5
5
|
*/
|
|
6
6
|
export type RebaseAuthController = AuthController & {
|
|
7
|
-
/** Login with Google — accepts
|
|
8
|
-
googleLogin: {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
7
|
+
/** Login with Google — accepts an ID token, access token, or authorization code payload */
|
|
8
|
+
googleLogin: (payload: {
|
|
9
|
+
idToken: string;
|
|
10
|
+
} | {
|
|
11
|
+
accessToken: string;
|
|
12
|
+
} | {
|
|
13
|
+
code: string;
|
|
14
|
+
redirectUri: string;
|
|
15
|
+
}) => Promise<void>;
|
|
15
16
|
/** Generic OAuth login — works with any provider. Posts payload to /auth/{providerId}. */
|
|
16
17
|
oauthLogin: (providerId: string, payload: Record<string, unknown>) => Promise<void>;
|
|
17
18
|
/** Login with email and password */
|
|
@@ -44,6 +45,10 @@ export type RebaseAuthController = AuthController & {
|
|
|
44
45
|
revokeAllSessions: () => Promise<void>;
|
|
45
46
|
/** Get internal API URL */
|
|
46
47
|
getApiUrl?: () => string | undefined;
|
|
48
|
+
/** Clear the current auth provider error */
|
|
49
|
+
clearError: () => void;
|
|
50
|
+
/** Set or clear the auth provider error */
|
|
51
|
+
setAuthProviderError: (error: Error | null) => void;
|
|
47
52
|
};
|
|
48
53
|
/**
|
|
49
54
|
* Props for useRebaseAuthController hook
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rebasepro/auth",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.1
|
|
4
|
+
"version": "0.2.1",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
7
7
|
},
|
|
@@ -11,9 +11,9 @@
|
|
|
11
11
|
"types": "./dist/index.d.ts",
|
|
12
12
|
"source": "src/index.ts",
|
|
13
13
|
"dependencies": {
|
|
14
|
-
"@rebasepro/
|
|
15
|
-
"@rebasepro/ui": "0.1
|
|
16
|
-
"@rebasepro/
|
|
14
|
+
"@rebasepro/core": "0.2.1",
|
|
15
|
+
"@rebasepro/ui": "0.2.1",
|
|
16
|
+
"@rebasepro/types": "0.2.1"
|
|
17
17
|
},
|
|
18
18
|
"peerDependencies": {
|
|
19
19
|
"react": ">=19.0.0",
|
|
@@ -22,18 +22,19 @@
|
|
|
22
22
|
"exports": {
|
|
23
23
|
".": {
|
|
24
24
|
"types": "./dist/index.d.ts",
|
|
25
|
-
"development": "./
|
|
25
|
+
"development": "./dist/index.es.js",
|
|
26
26
|
"import": "./dist/index.es.js",
|
|
27
27
|
"require": "./dist/index.umd.js"
|
|
28
28
|
},
|
|
29
29
|
"./package.json": "./package.json"
|
|
30
30
|
},
|
|
31
31
|
"devDependencies": {
|
|
32
|
-
"@types/node": "^20.19.
|
|
33
|
-
"@types/react": "^19.
|
|
34
|
-
"@types/react-dom": "^19.
|
|
32
|
+
"@types/node": "^20.19.41",
|
|
33
|
+
"@types/react": "^19.2.15",
|
|
34
|
+
"@types/react-dom": "^19.2.3",
|
|
35
|
+
"@vitejs/plugin-react": "^4.7.0",
|
|
35
36
|
"typescript": "^5.9.3",
|
|
36
|
-
"vite": "^7.
|
|
37
|
+
"vite": "^7.3.3"
|
|
37
38
|
},
|
|
38
39
|
"files": [
|
|
39
40
|
"dist",
|
package/src/api.ts
CHANGED
|
@@ -113,23 +113,16 @@ export type GoogleLoginPayload =
|
|
|
113
113
|
/**
|
|
114
114
|
* Login with Google.
|
|
115
115
|
*
|
|
116
|
-
*
|
|
117
|
-
*
|
|
116
|
+
* Accepts one of:
|
|
117
|
+
* - `{ idToken }` — ID-token flow (One Tap / Sign In button)
|
|
118
|
+
* - `{ accessToken }` — Access-token flow (popup)
|
|
119
|
+
* - `{ code, redirectUri }` — Authorization code flow (most secure)
|
|
118
120
|
*/
|
|
119
|
-
export async function googleLogin(payload: GoogleLoginPayload): Promise<AuthResponse
|
|
120
|
-
export async function googleLogin(token: string, tokenType?: "idToken" | "accessToken"): Promise<AuthResponse>;
|
|
121
|
-
export async function googleLogin(
|
|
122
|
-
tokenOrPayload: string | GoogleLoginPayload,
|
|
123
|
-
tokenType: "idToken" | "accessToken" = "idToken"
|
|
124
|
-
): Promise<AuthResponse> {
|
|
125
|
-
const body = typeof tokenOrPayload === "string"
|
|
126
|
-
? { [tokenType]: tokenOrPayload }
|
|
127
|
-
: tokenOrPayload;
|
|
128
|
-
|
|
121
|
+
export async function googleLogin(payload: GoogleLoginPayload): Promise<AuthResponse> {
|
|
129
122
|
const response = await fetchWithHandling(`${baseApiUrl}/api/auth/google`, {
|
|
130
123
|
method: "POST",
|
|
131
124
|
headers: { "Content-Type": "application/json" },
|
|
132
|
-
body: JSON.stringify(
|
|
125
|
+
body: JSON.stringify(payload)
|
|
133
126
|
});
|
|
134
127
|
|
|
135
128
|
return handleResponse<AuthResponse>(response);
|
|
@@ -167,15 +160,12 @@ export async function oauthLogin(providerId: string, payload: Record<string, unk
|
|
|
167
160
|
* Refresh access token using refresh token
|
|
168
161
|
*/
|
|
169
162
|
export async function refreshAccessToken(refreshToken: string): Promise<RefreshResponse> {
|
|
170
|
-
console.log("[AUTH-API] Calling refresh endpoint...");
|
|
171
|
-
|
|
172
163
|
const response = await fetchWithHandling(`${baseApiUrl}/api/auth/refresh`, {
|
|
173
164
|
method: "POST",
|
|
174
165
|
headers: { "Content-Type": "application/json" },
|
|
175
166
|
body: JSON.stringify({ refreshToken })
|
|
176
167
|
});
|
|
177
168
|
|
|
178
|
-
console.log("[AUTH-API] Refresh response status:", response.status);
|
|
179
169
|
return handleResponse<RefreshResponse>(response);
|
|
180
170
|
}
|
|
181
171
|
|
|
@@ -359,14 +349,10 @@ export interface AuthConfigResponse {
|
|
|
359
349
|
needsSetup: boolean;
|
|
360
350
|
/** Whether new user registration is enabled */
|
|
361
351
|
registrationEnabled: boolean;
|
|
362
|
-
/** Whether Google OAuth is configured */
|
|
363
|
-
googleEnabled: boolean;
|
|
364
|
-
/** Whether LinkedIn OAuth is configured */
|
|
365
|
-
linkedinEnabled: boolean;
|
|
366
352
|
/** Whether email service is configured */
|
|
367
353
|
emailServiceEnabled: boolean;
|
|
368
354
|
/** Complete list of enabled OAuth provider IDs (e.g. ["google", "github", "discord"]) */
|
|
369
|
-
enabledProviders
|
|
355
|
+
enabledProviders: string[];
|
|
370
356
|
}
|
|
371
357
|
|
|
372
358
|
/**
|
|
@@ -375,14 +361,26 @@ export interface AuthConfigResponse {
|
|
|
375
361
|
*/
|
|
376
362
|
let authConfigInflight: Promise<AuthConfigResponse> | null = null;
|
|
377
363
|
|
|
364
|
+
/**
|
|
365
|
+
* Cached result of the last successful `fetchAuthConfig` call.
|
|
366
|
+
* Auth config is static for the lifetime of the app session, so
|
|
367
|
+
* repeat calls (e.g. from effect re-runs) return instantly.
|
|
368
|
+
*/
|
|
369
|
+
let authConfigCached: AuthConfigResponse | null = null;
|
|
370
|
+
|
|
378
371
|
/**
|
|
379
372
|
* Fetch auth configuration / status from the backend
|
|
380
373
|
* This is an unauthenticated endpoint used to detect bootstrap mode.
|
|
381
374
|
*
|
|
375
|
+
* Results are cached for the session lifetime.
|
|
382
376
|
* Concurrent calls are deduplicated: only one network request is made
|
|
383
377
|
* and all callers share the same promise.
|
|
384
378
|
*/
|
|
385
379
|
export async function fetchAuthConfig(): Promise<AuthConfigResponse> {
|
|
380
|
+
if (authConfigCached) {
|
|
381
|
+
return authConfigCached;
|
|
382
|
+
}
|
|
383
|
+
|
|
386
384
|
if (authConfigInflight) {
|
|
387
385
|
return authConfigInflight;
|
|
388
386
|
}
|
|
@@ -396,11 +394,22 @@ export async function fetchAuthConfig(): Promise<AuthConfigResponse> {
|
|
|
396
394
|
})();
|
|
397
395
|
|
|
398
396
|
try {
|
|
399
|
-
|
|
397
|
+
const result = await authConfigInflight;
|
|
398
|
+
authConfigCached = result;
|
|
399
|
+
return result;
|
|
400
400
|
} finally {
|
|
401
401
|
authConfigInflight = null;
|
|
402
402
|
}
|
|
403
403
|
}
|
|
404
404
|
|
|
405
|
+
/**
|
|
406
|
+
* Clear the cached auth config (e.g. on logout or for testing).
|
|
407
|
+
*/
|
|
408
|
+
export function clearAuthConfigCache(): void {
|
|
409
|
+
authConfigCached = null;
|
|
410
|
+
authConfigInflight = null;
|
|
411
|
+
}
|
|
412
|
+
|
|
405
413
|
export { AuthApiError };
|
|
406
414
|
|
|
415
|
+
|
|
@@ -284,6 +284,15 @@ export function useBackendUserManagement(config: BackendUserManagementConfig): U
|
|
|
284
284
|
return;
|
|
285
285
|
}
|
|
286
286
|
|
|
287
|
+
// Skip admin API calls for non-admin users — they'd get 403 anyway.
|
|
288
|
+
// This avoids a spurious warning in backend logs on every non-admin login.
|
|
289
|
+
const userRoles = currentUser.roles ?? [];
|
|
290
|
+
const isUserAdmin = userRoles.some(r => r === "admin" || r === "schema-admin");
|
|
291
|
+
if (!isUserAdmin) {
|
|
292
|
+
setLoading(false);
|
|
293
|
+
return;
|
|
294
|
+
}
|
|
295
|
+
|
|
287
296
|
// Skip refetch if we already loaded data for this same UID
|
|
288
297
|
// (e.g. React StrictMode unmounts and re-mounts with the same user).
|
|
289
298
|
if (lastLoadedUidRef.current === currentUser.uid) {
|
|
@@ -548,7 +557,7 @@ export function useBackendUserManagement(config: BackendUserManagementConfig): U
|
|
|
548
557
|
saveRole,
|
|
549
558
|
deleteRole,
|
|
550
559
|
isAdmin,
|
|
551
|
-
allowDefaultRolesCreation:
|
|
560
|
+
allowDefaultRolesCreation: isAdmin,
|
|
552
561
|
includeCollectionConfigPermissions: true,
|
|
553
562
|
defineRolesFor,
|
|
554
563
|
getUser,
|
|
@@ -42,11 +42,8 @@ interface StoredAuthData {
|
|
|
42
42
|
*/
|
|
43
43
|
function saveAuthToStorage(tokens: AuthTokens, user: UserInfo): void {
|
|
44
44
|
try {
|
|
45
|
-
const data: StoredAuthData = { tokens,
|
|
46
|
-
user };
|
|
45
|
+
const data: StoredAuthData = { tokens, user };
|
|
47
46
|
localStorage.setItem(STORAGE_KEY, JSON.stringify(data));
|
|
48
|
-
const expiryDate = new Date(tokens.accessTokenExpiresAt);
|
|
49
|
-
const expiryStr = Number.isFinite(tokens.accessTokenExpiresAt) ? expiryDate.toISOString() : "invalid";
|
|
50
47
|
} catch (e) { /* ignore */ }
|
|
51
48
|
}
|
|
52
49
|
|
|
@@ -122,6 +119,10 @@ export function useRebaseAuthController(
|
|
|
122
119
|
}
|
|
123
120
|
}, [client, apiUrl]);
|
|
124
121
|
|
|
122
|
+
const clearError = useCallback(() => {
|
|
123
|
+
setAuthProviderError(null);
|
|
124
|
+
}, []);
|
|
125
|
+
|
|
125
126
|
// Clear session and sign out
|
|
126
127
|
const clearSessionAndSignOut = useCallback(() => {
|
|
127
128
|
tokensRef.current = null;
|
|
@@ -177,7 +178,6 @@ export function useRebaseAuthController(
|
|
|
177
178
|
saveAuthToStorage(newTokens, latestStoredData.user);
|
|
178
179
|
}
|
|
179
180
|
|
|
180
|
-
const newExpiryStr = Number.isFinite(newTokens.accessTokenExpiresAt) ? new Date(newTokens.accessTokenExpiresAt).toISOString() : "invalid";
|
|
181
181
|
return newTokens;
|
|
182
182
|
} catch (error: unknown) {
|
|
183
183
|
|
|
@@ -306,7 +306,6 @@ export function useRebaseAuthController(
|
|
|
306
306
|
|
|
307
307
|
// Handle successful authentication
|
|
308
308
|
const handleAuthSuccess = useCallback(async (userInfo: UserInfo, tokens: AuthTokens) => {
|
|
309
|
-
console.log("[Auth] handleAuthSuccess called, user:", userInfo.email, "uid:", userInfo.uid);
|
|
310
309
|
tokensRef.current = tokens;
|
|
311
310
|
let convertedUser = convertToUser(userInfo);
|
|
312
311
|
|
|
@@ -314,21 +313,18 @@ export function useRebaseAuthController(
|
|
|
314
313
|
if (defineRolesFor) {
|
|
315
314
|
const customRoles = await defineRolesFor(convertedUser);
|
|
316
315
|
if (customRoles) {
|
|
317
|
-
convertedUser = { ...convertedUser,
|
|
318
|
-
roles: customRoles.map(r => r.id) };
|
|
316
|
+
convertedUser = { ...convertedUser, roles: customRoles.map(r => r.id) };
|
|
319
317
|
}
|
|
320
318
|
}
|
|
321
319
|
|
|
322
320
|
// Save to localStorage for persistence
|
|
323
321
|
saveAuthToStorage(tokens, userInfo);
|
|
324
322
|
|
|
325
|
-
console.log("[Auth] Calling setUser, roles:", convertedUser.roles);
|
|
326
323
|
setUser(convertedUser);
|
|
327
324
|
setAuthError(null);
|
|
328
325
|
setAuthProviderError(null);
|
|
329
326
|
setLoginSkipped(false);
|
|
330
327
|
scheduleTokenRefresh(tokens);
|
|
331
|
-
console.log("[Auth] handleAuthSuccess completed");
|
|
332
328
|
}, [scheduleTokenRefresh, defineRolesFor]);
|
|
333
329
|
|
|
334
330
|
// Email/password login
|
|
@@ -363,18 +359,15 @@ roles: customRoles.map(r => r.id) };
|
|
|
363
359
|
}
|
|
364
360
|
}, [handleAuthSuccess]);
|
|
365
361
|
|
|
366
|
-
// Google login —
|
|
362
|
+
// Google login — accepts payload object with code flow or token
|
|
367
363
|
const googleLogin = useCallback(async (
|
|
368
|
-
|
|
369
|
-
tokenType?: "idToken" | "accessToken"
|
|
364
|
+
payload: { code: string; redirectUri: string } | { idToken: string } | { accessToken: string }
|
|
370
365
|
) => {
|
|
371
366
|
setAuthLoading(true);
|
|
372
367
|
setAuthProviderError(null);
|
|
373
368
|
|
|
374
369
|
try {
|
|
375
|
-
const response =
|
|
376
|
-
? await authApi.googleLogin(tokenOrPayload, tokenType ?? "idToken")
|
|
377
|
-
: await authApi.googleLogin(tokenOrPayload);
|
|
370
|
+
const response = await authApi.googleLogin(payload);
|
|
378
371
|
await handleAuthSuccess(response.user, response.tokens);
|
|
379
372
|
} catch (error: unknown) {
|
|
380
373
|
setAuthProviderError(error as Error);
|
|
@@ -742,6 +735,8 @@ roles: customRoles.map(r => r.id) };
|
|
|
742
735
|
fetchSessions,
|
|
743
736
|
revokeSession,
|
|
744
737
|
revokeAllSessions,
|
|
738
|
+
clearError,
|
|
739
|
+
setAuthProviderError,
|
|
745
740
|
extra,
|
|
746
741
|
setExtra,
|
|
747
742
|
capabilities: {
|
package/src/index.ts
CHANGED
|
@@ -21,13 +21,6 @@ export { useRebaseAuthController } from "./hooks/useRebaseAuthController";
|
|
|
21
21
|
export { useBackendUserManagement } from "./hooks/useBackendUserManagement";
|
|
22
22
|
export type { BackendUserManagementConfig, UserManagement } from "./hooks/useBackendUserManagement";
|
|
23
23
|
|
|
24
|
-
// Legacy re-exports for backward compatibility
|
|
25
|
-
// The UI components have moved to @rebasepro/core
|
|
26
|
-
export { RebaseLoginView } from "./components/RebaseLoginView";
|
|
27
|
-
export type { RebaseLoginViewProps } from "./components/RebaseLoginView";
|
|
28
|
-
export { RebaseAuth } from "./components/RebaseAuth";
|
|
29
|
-
export { createUserManagementAdminViews, UsersView, RolesView } from "./components/AdminViews";
|
|
30
|
-
|
|
31
24
|
// API utilities
|
|
32
|
-
export { setApiUrl, getApiUrl, fetchAuthConfig, AuthApiError } from "./api";
|
|
25
|
+
export { setApiUrl, getApiUrl, fetchAuthConfig, clearAuthConfigCache, AuthApiError } from "./api";
|
|
33
26
|
export type { AuthConfigResponse } from "./api";
|
package/src/types.ts
CHANGED
|
@@ -5,11 +5,8 @@ import { AuthController, Role, User } from "@rebasepro/types";
|
|
|
5
5
|
* with additional methods for email/password and Google login
|
|
6
6
|
*/
|
|
7
7
|
export type RebaseAuthController = AuthController & {
|
|
8
|
-
/** Login with Google — accepts
|
|
9
|
-
googleLogin: {
|
|
10
|
-
(token: string, tokenType?: "idToken" | "accessToken"): Promise<void>;
|
|
11
|
-
(payload: { code: string; redirectUri: string }): Promise<void>;
|
|
12
|
-
};
|
|
8
|
+
/** Login with Google — accepts an ID token, access token, or authorization code payload */
|
|
9
|
+
googleLogin: (payload: { idToken: string } | { accessToken: string } | { code: string; redirectUri: string }) => Promise<void>;
|
|
13
10
|
/** Generic OAuth login — works with any provider. Posts payload to /auth/{providerId}. */
|
|
14
11
|
oauthLogin: (providerId: string, payload: Record<string, unknown>) => Promise<void>;
|
|
15
12
|
/** Login with email and password */
|
|
@@ -42,6 +39,10 @@ export type RebaseAuthController = AuthController & {
|
|
|
42
39
|
revokeAllSessions: () => Promise<void>;
|
|
43
40
|
/** Get internal API URL */
|
|
44
41
|
getApiUrl?: () => string | undefined;
|
|
42
|
+
/** Clear the current auth provider error */
|
|
43
|
+
clearError: () => void;
|
|
44
|
+
/** Set or clear the auth provider error */
|
|
45
|
+
setAuthProviderError: (error: Error | null) => void;
|
|
45
46
|
}
|
|
46
47
|
|
|
47
48
|
/**
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import { AppView, EntityCollection } from "@rebasepro/types";
|
|
2
|
-
import { UserManagement } from "../hooks/useBackendUserManagement";
|
|
3
|
-
interface AdminViewsProps {
|
|
4
|
-
userManagement: UserManagement;
|
|
5
|
-
apiUrl: string;
|
|
6
|
-
getAuthToken: () => Promise<string>;
|
|
7
|
-
collections?: EntityCollection[];
|
|
8
|
-
}
|
|
9
|
-
/**
|
|
10
|
-
* Create admin views for user and role management
|
|
11
|
-
*/
|
|
12
|
-
export declare function createUserManagementAdminViews({ userManagement, apiUrl, getAuthToken, collections }: AdminViewsProps): AppView[];
|
|
13
|
-
export declare function UsersView({ userManagement, apiUrl, getAuthToken }: {
|
|
14
|
-
userManagement: UserManagement;
|
|
15
|
-
apiUrl: string;
|
|
16
|
-
getAuthToken: () => Promise<string>;
|
|
17
|
-
}): import("react/jsx-runtime").JSX.Element;
|
|
18
|
-
export declare function RolesView({ userManagement, collections }: {
|
|
19
|
-
userManagement: UserManagement;
|
|
20
|
-
collections?: EntityCollection[];
|
|
21
|
-
}): import("react/jsx-runtime").JSX.Element;
|
|
22
|
-
export {};
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import type { RebaseAuthConfig } from "@rebasepro/types";
|
|
2
|
-
/**
|
|
3
|
-
* Declarative component to configure authentication in Rebase.
|
|
4
|
-
* Renders nothing — purely registers config into the RebaseRegistry.
|
|
5
|
-
*/
|
|
6
|
-
export declare function RebaseAuth({ loginView }: RebaseAuthConfig): null;
|
|
@@ -1,73 +0,0 @@
|
|
|
1
|
-
import { ReactNode } from "react";
|
|
2
|
-
import { RebaseAuthController } from "../types";
|
|
3
|
-
/**
|
|
4
|
-
* Props for RebaseLoginView
|
|
5
|
-
*/
|
|
6
|
-
export interface RebaseLoginViewProps {
|
|
7
|
-
/**
|
|
8
|
-
* Auth controller from useRebaseAuthController
|
|
9
|
-
*/
|
|
10
|
-
authController: RebaseAuthController;
|
|
11
|
-
/**
|
|
12
|
-
* Path to the logo displayed in the login screen
|
|
13
|
-
*/
|
|
14
|
-
logo?: string;
|
|
15
|
-
/**
|
|
16
|
-
* Enable the skip login button
|
|
17
|
-
*/
|
|
18
|
-
allowSkipLogin?: boolean;
|
|
19
|
-
/**
|
|
20
|
-
* Disable the login buttons
|
|
21
|
-
*/
|
|
22
|
-
disabled?: boolean;
|
|
23
|
-
/**
|
|
24
|
-
* Prevent users from creating new accounts
|
|
25
|
-
*/
|
|
26
|
-
disableSignupScreen?: boolean;
|
|
27
|
-
/**
|
|
28
|
-
* Display this component when no user is found
|
|
29
|
-
*/
|
|
30
|
-
noUserComponent?: ReactNode;
|
|
31
|
-
/**
|
|
32
|
-
* Display this component below the sign-in buttons
|
|
33
|
-
*/
|
|
34
|
-
additionalComponent?: ReactNode;
|
|
35
|
-
/**
|
|
36
|
-
* Error message when user is not allowed access
|
|
37
|
-
*/
|
|
38
|
-
notAllowedError?: string | Error;
|
|
39
|
-
/**
|
|
40
|
-
* Enable Google login button (requires googleClientId in hook)
|
|
41
|
-
*/
|
|
42
|
-
googleEnabled?: boolean;
|
|
43
|
-
/**
|
|
44
|
-
* Google client ID for OAuth
|
|
45
|
-
*/
|
|
46
|
-
googleClientId?: string;
|
|
47
|
-
}
|
|
48
|
-
/**
|
|
49
|
-
* Login view component for custom JWT authentication
|
|
50
|
-
*/
|
|
51
|
-
export declare function RebaseLoginView({ logo, authController, noUserComponent, disableSignupScreen, disabled, notAllowedError, googleEnabled, googleClientId }: RebaseLoginViewProps): import("react/jsx-runtime").JSX.Element;
|
|
52
|
-
/** Google Identity Services SDK — injected by the GIS <script> tag. */
|
|
53
|
-
declare global {
|
|
54
|
-
interface Window {
|
|
55
|
-
google?: {
|
|
56
|
-
accounts: {
|
|
57
|
-
oauth2: {
|
|
58
|
-
initCodeClient(config: {
|
|
59
|
-
client_id: string;
|
|
60
|
-
scope: string;
|
|
61
|
-
ux_mode: "popup" | "redirect";
|
|
62
|
-
callback: (response: {
|
|
63
|
-
code?: string;
|
|
64
|
-
error?: string;
|
|
65
|
-
}) => void;
|
|
66
|
-
}): {
|
|
67
|
-
requestCode(): void;
|
|
68
|
-
};
|
|
69
|
-
};
|
|
70
|
-
};
|
|
71
|
-
};
|
|
72
|
-
}
|
|
73
|
-
}
|