UNPKG

ng7-auth

Version:

Firestore Authentication with Angular. A Fork form Anthony Nahas.

81 lines (80 loc) 3.54 kB
import { EventEmitter } from '@angular/core'; import { MatSnackBar } from '@angular/material'; import { AngularFireAuth } from '@angular/fire/auth'; import { ISignInProcess, ISignUpProcess } from '../interfaces/main.interface'; import { NgxAuthFirebaseUIConfig } from '../interfaces/config.interface'; import { FirestoreSyncService } from './firestore-sync.service'; import * as firebase from 'firebase/app'; import 'firebase/auth'; import { User, UserInfo } from 'firebase/app'; import UserCredential = firebase.auth.UserCredential; export declare const facebookAuthProvider: firebase.auth.FacebookAuthProvider; export declare const googleAuthProvider: firebase.auth.GoogleAuthProvider; export declare const twitterAuthProvider: firebase.auth.TwitterAuthProvider; export declare const githubAuthProvider: firebase.auth.GithubAuthProvider; export declare enum AuthProvider { ALL = "all", ANONYMOUS = "anonymous", EmailAndPassword = "firebase", Google = "google", Facebook = "facebook", Twitter = "twitter", Github = "github", PhoneNumber = "phoneNumber" } export declare class AuthProcessService implements ISignInProcess, ISignUpProcess { config: NgxAuthFirebaseUIConfig; afa: AngularFireAuth; _snackBar: MatSnackBar; private _fireStoreService; onSuccessEmitter: EventEmitter<any>; onErrorEmitter: EventEmitter<any>; isLoading: boolean; emailConfirmationSent: boolean; emailToConfirm: string; constructor(config: NgxAuthFirebaseUIConfig, afa: AngularFireAuth, _snackBar: MatSnackBar, _fireStoreService: FirestoreSyncService); /** * Reset the password of the user via email * * @param email - the email to reset * @returns */ resetPassword(email: string): Promise<void>; /** * General sign in mechanism to authenticate the users with a firebase project * using a traditional way, via username and password or by using an authentication provider * like google, facebook, twitter and github * * @param provider - the provider to authenticate with (google, facebook, twitter, github) * @param email - (optional) the email of user - used only for a traditional sign in * @param password - (optional) the password of user - used only for a traditional sign in * @returns */ signInWith(provider: AuthProvider, email?: string, password?: string): Promise<void>; /** * Sign up new users via email and password. * After that the user should verify and confirm an email sent via the firebase * * @param name - the name if the new user * @param email - the email if the new user * @param password - the password if the new user * @returns */ signUp(name: string, email: string, password: string): Promise<void>; /** * Update the profile (name + photo url) of the authenticated user in the * firebase authentication feature (not in firestore) * * @param name - the new name of the authenticated user * @param photoURL - the new photo url of the authenticated user * @returns */ updateProfile(name: string, photoURL: string): Promise<any>; deleteAccount(): Promise<any>; parseUserInfo(user: User): UserInfo; getUserPhotoUrl(): string; getPhotoPath(image: string): string; signInWithPhoneNumber(): void; handleSuccess(userCredential: UserCredential): Promise<void>; handleError(error: any): void; }