UNPKG

@react-native-ohos/realm

Version:

Realm by MongoDB is an offline-first mobile database: an alternative to SQLite and key-value stores

82 lines 3.91 kB
/** * Types of an authentication provider. */ export declare enum ProviderType { AnonUser = "anon-user", ApiKey = "api-key", LocalUserPass = "local-userpass", CustomFunction = "custom-function", CustomToken = "custom-token", OAuth2Google = "oauth2-google", OAuth2Facebook = "oauth2-facebook", OAuth2Apple = "oauth2-apple" } export declare function isProviderType(arg: string): arg is ProviderType; export declare class Credentials { /** * Creates credentials for an anonymous user. These can only be used once - using them a second * time will result in a different user being logged in. If you need to get a user that has already logged * in with the Anonymous credentials, use {@link App.currentUser} or {@link App.allUsers}. * @param reuse - Reuse any existing anonymous user already logged in. * @returns An instance of `Credentials` that can be used in {@link App.logIn}. * @see https://docs.mongodb.com/realm/authentication/anonymous/ */ static anonymous(reuse?: boolean): Credentials; /** * Creates credentials based on a login with an email address and a password. * @returns An instance of `Credentials` that can be used in {@link App.logIn}. * @see https://www.mongodb.com/docs/atlas/app-services/authentication/email-password/ */ static emailPassword(credentials: { email: string; password: string; }): Credentials; static emailPassword(email: string, password: string): Credentials; /** * Creates credentials from an API key. * @param key - A string identifying the API key. * @returns An instance of `Credentials` that can be used in {@link App.logIn}. * @see https://www.mongodb.com/docs/atlas/app-services/authentication/api-key/ */ static apiKey(key: string): Credentials; /** * Creates credentials based on an Apple login. * @param token - An Apple authentication token, obtained by logging into Apple. * @returns An instance of `Credentials` that can be used in {@link App.logIn}. * @see https://www.mongodb.com/docs/atlas/app-services/authentication/apple/ */ static apple(token: string): Credentials; /** * Creates credentials based on a Facebook login. * @param token - A Facebook authentication token, obtained by logging into Facebook. * @returns An instance of `Credentials` that can be used in {@link App.logIn}. * @see https://www.mongodb.com/docs/atlas/app-services/authentication/facebook/ */ static facebook(token: string): Credentials; /** * Creates credentials based on a Google login. * @param authObject - An object with either an `authCode` or `idToken` property. * @returns An instance of `Credentials` that can be used in {@link App.logIn}. * @see https://www.mongodb.com/docs/atlas/app-services/authentication/google/ */ static google(authObject: { authCode: string; } | { idToken: string; }): Credentials; /** * Creates credentials with a JSON Web Token (JWT) provider and user identifier. * @param token - A string identifying the user. Usually an identity token or a username. * @returns An instance of `Credentials` that can be used in {@link App.logIn}. * @see https://www.mongodb.com/docs/atlas/app-services/authentication/custom-jwt/ */ static jwt(token: string): Credentials; /** * Creates credentials with an Atlas App Services function and user identifier. * @param payload - An object identifying the user. Usually an identity token or a username. * @returns An instance of `Credentials` that can be used in {@link App.logIn}. * @see https://www.mongodb.com/docs/atlas/app-services/authentication/custom-function/ */ static function(payload: object): Credentials; } //# sourceMappingURL=Credentials.d.ts.map