@kinde-oss/kinde-auth-react
Version:
Kinde React SDK for authentication
51 lines • 2.16 kB
TypeScript
import { UserProfile, RefreshTokenResult, SessionManager } from '@kinde/js-utils';
import { default as React } from 'react';
import { KindeContextProps } from './KindeContext';
import { ErrorProps, PopupOptions, ActivityTimeoutConfig } from './types';
declare enum AuthEvent {
login = "login",
logout = "logout",
register = "register",
tokenRefreshed = "tokenRefreshed"
}
type EventTypes = {
(event: AuthEvent.tokenRefreshed, state: RefreshTokenResult, context: KindeContextProps): void;
(event: AuthEvent, state: Record<string, unknown>, context: KindeContextProps): void;
};
type KindeCallbacks = {
onSuccess?: (user: UserProfile, state: Record<string, unknown>, context: KindeContextProps) => void;
onError?: (props: ErrorProps, state: Record<string, string>, context: KindeContextProps) => void;
onEvent?: EventTypes;
};
type KindeProviderProps = {
audience?: string;
children: React.ReactNode;
clientId: string;
domain: string;
/**
* Use localstorage for refresh token.
*
* Note: This is not recommended for production use, as it is less secure. Use custom domain and refresh token will have handled without localStorage automatically
*/
useInsecureForRefreshToken?: boolean;
logoutUri?: string;
redirectUri: string;
callbacks?: KindeCallbacks;
scope?: string;
forceChildrenRender?: boolean;
/**
* When the application is shown in an iFrame, auth will open in a popup window.
* This is the options for the popup window.
*/
popupOptions?: PopupOptions;
store?: SessionManager;
/**
* Configuration for activity timeout tracking.
* ⚠️ Must be memoized or defined outside component to prevent effect re-runs.
*/
activityTimeout?: ActivityTimeoutConfig;
refreshOnFocus?: boolean;
};
export declare const KindeProvider: ({ audience, scope, clientId, children, domain, useInsecureForRefreshToken, redirectUri, callbacks, logoutUri, forceChildrenRender, popupOptions, store, activityTimeout, refreshOnFocus, }: KindeProviderProps) => React.JSX.Element;
export {};
//# sourceMappingURL=KindeProvider.d.ts.map