import Realm from "realm"; import { AuthResult } from "./types"; interface UseAuth { /** * Log in with a {@link Realm.Credentials} instance. This allows login with any * authentication mechanism supported by Realm. * If this is called when a user is currently logged in, it will switch the user. */ logIn(credentials: Realm.Credentials): void; /** * Log in with the Anonymous authentication provider. * @returns A `Realm.User` instance for the logged in user. * @see https://www.mongodb.com/docs/atlas/app-services/authentication/anonymous/ */ logInWithAnonymous(): void; /** * Log in with an API key. * @see https://www.mongodb.com/docs/atlas/app-services/authentication/api-key/ */ logInWithApiKey(key: string): void; /** * Log in with Email / Password. * @see https://www.mongodb.com/docs/atlas/app-services/authentication/email-password/ */ logInWithEmailPassword(credentials: { email: string; password: string; }): void; /** * Log in with a JSON Web Token (JWT). * @see https://www.mongodb.com/docs/atlas/app-services/authentication/custom-jwt/ */ logInWithJWT(token: string): void; /** * Log in with Google. * @see https://www.mongodb.com/docs/atlas/app-services/authentication/google/ */ logInWithGoogle(credentials: { idToken: string; } | { authCode: string; }): void; /** * Log in with Apple. * @see https://www.mongodb.com/docs/atlas/app-services/authentication/apple/ */ logInWithApple(idToken: string): void; /** * Log in with Facebook. * @see https://www.mongodb.com/docs/atlas/app-services/authentication/facebook/ */ logInWithFacebook(accessToken: string): void; /** * Log in with a custom function. * @see https://www.mongodb.com/docs/atlas/app-services/authentication/custom-function/ */ logInWithFunction>(payload: PayloadType): void; /** * Log out the current user. */ logOut(): void; /** * The {@link AuthResult} of the current (or last) login operation performed * for this hook. There is one {@link AuthResult} for all `login` * operations within a given `AppProvider` context, as only one login can * be in progress at a time (e.g. the {@link AuthResult} of `loginUser` from * `useEmailPasswordAuth` is also represented by this). */ result: AuthResult; } /** * Hook providing operations and corresponding state for authenticating with an * Atlas App. * * The {@link AuthResult} values returned from this hook (e.g. `state`, `pending`, etc.) are * shared across all components under a given `AppProvider`, as only one operation can be in * progress at a given time (i.e. we will store the values on the context). This means that, * for example, multiple components can use the `useAuth` hook to access * `loginResult.pending` to render a spinner when login is in progress, without * needing to pass that state around or store it somewhere global in their app * code. * @returns An object containing operations and state for authenticating with an Atlas App. */ export declare function useAuth(): UseAuth; export {}; //# sourceMappingURL=useAuth.d.ts.map