小编Fra*_*pin的帖子

Firebase云功能 - createCustomToken

将新的Firebase云功能与admin sdk结合使用.

我想使用admin.auth().createCustomToken()函数.调用此函数会导致错误消息

Error: createCustomToken() requires a certificate with "private_key" set.
    at FirebaseAuthError.Error (native)
    at FirebaseAuthError.FirebaseError [as constructor] (/user_code/node_modules/firebase-admin/lib/utils/error.js:25:28)
    at new FirebaseAuthError (/user_code/node_modules/firebase-admin/lib/utils/error.js:90:23)
    at FirebaseTokenGenerator.createCustomToken (/user_code/node_modules/firebase-admin/lib/auth/token-generator.js:62:19)
    at Auth.createCustomToken (/user_code/node_modules/firebase-admin/lib/auth/auth.js:89:37)
    at /user_code/index.js:29:26
    at process._tickDomainCallback (internal/process/next_tick.js:129:7)
Run Code Online (Sandbox Code Playgroud)

如何配置云功能以使用private_key?

admin.initializeApp(functions.config().firebase);
Run Code Online (Sandbox Code Playgroud)

firebase google-cloud-functions

15
推荐指数
1
解决办法
5321
查看次数

Angular 2 - Angularfire 2身份验证状态

我迷失在可观察,承诺和状态的疯狂中.我需要帮助来解决这个问题.

我正在尝试使用Angularfire2模块在angular 2应用程序中实现注册/登录/注册功能.我从登录功能开始.我掌握了基础知识.我可以登录并重定向到新页面.到现在为止还挺好.在我的模板中,我正在检查用户是否已登录.这里开始麻烦了.我很难检查当前用户是否已登录.

Login.components.ts

import { Component, OnInit } from '@angular/core';
import {Validators, FormGroup, FormBuilder } from '@angular/forms';
import { AuthService } from '../auth.service';
import {Router} from '@angular/router';

@Component({
  selector: 'app-login',
  templateUrl: './login.component.html',
  styleUrls: ['./login.component.css']
})
export class LoginComponent implements OnInit {

  form: FormGroup;
  error = false;
  errorMessage = '';

  constructor(private fb:FormBuilder, private authService:AuthService, private router:Router) {}

  ngOnInit() {
     this.form = this.fb.group({
      email: ['', Validators.required],
      password: ['', Validators.required]
    });
  }

  onLogin() {
    this.authService.loginUser(this.form.value.email, this.form.value.password)
    .subscribe(
      () => this.router.navigate(['/'])
    )
  } …
Run Code Online (Sandbox Code Playgroud)

firebase firebase-authentication angularfire2 angular

3
推荐指数
1
解决办法
3033
查看次数

按顺序分派乘法操作-ngrx

我想知道如何按顺序分配乘法操作。

  @Effect()
  getClients$: Observable<Action> = this.actions$
    .ofType(ClientActions.GET_CLIENTS)
    .withLatestFrom(this.store.select(fromRoot.getClients))
    .filter(([action, clients]) => clients.length === 0)
    .map(action => new LayoutActions.IsLoading(true))
    .switchMap(() => this.clientService.getClients())
    .map(clients => new ClientActions.GetClientsReceived(clients));
Run Code Online (Sandbox Code Playgroud)

在上面的示例中,未调度第一个操作。getClients()方法和上一个操作均正常运行。

ngrx ngrx-effects angular

1
推荐指数
1
解决办法
1031
查看次数