[AngularFire2] Auth with Firebase auth -- email
-- with email auth firebase
2023-09-14 09:00:52 时间
First, you need to enable the email auth in Firebase console.
Then implement the auth service:
login(email, password) { return this.fromFirebaseAuthPromise(this.auth$.login({ email, password },{ method: AuthMethods.Password, provider: AuthProviders.Password })); } fromFirebaseAuthPromise(promise) { const subject = new Subject<any>(); promise.then((res) => { subject.next(res); subject.complete(); }, err => { subject.error(err); subject.complete(); }); return subject.asObservable(); }
Because login method return Promise, we need to convert it to Observable. The way we do it is using 'subject'.
Controller:
login(){ const formValue = this.form.value; this.authService.login(formValue.email, formValue.password) .subscribe((res) => { this.router.navigate(['/home']); }) }
相关文章
- Laravel学习记录--request做文件上传
- Docker方式启动tomcat,访问首页出现404错误(第二篇 -- 将修改过的容器映射成镜像)
- Ghost-MDE -- Writing ghost post with markdown editor
- Datawhale组队学习 -- Task 1:变量、运算符、数据类型及位运算
- AE下载安装--Adobe After Effects 各版本软件获取==经验分享
- kafka 结合springboot实战--第二节
- AutoCAD2004软件下载地址及安装教程--cad所有版本!
- @Aspect注解背后的奥秘--下
- Dn下载Dimension 永久版下载及安装教程Dn软件--Adobe全家桶合集
- Microsoft Office 2010详细安装步骤--microsoft office 2010密钥在哪
- 【C++修炼之路】25.哈希应用--布隆过滤器
- 【Linux】Linux 编译器与调试器 -- gcc/g++/gdb 的使用
- ORA-39322: Cannot use transportable tablespace with TIMESTAMP WITH TIME ZONE columns and different time zone version. ORACLE 报错 故障修复 远程处理
- 语句掌握Oracle中用WITH语句的利用技巧(oracle的with)
- Oracle中利用WITH子句的使用(oracle中的with)
- 中文Access2000速成教程--1.5使用已有的数据自动建新表
- IOS开发之路--C语言指针