Skip to content

Authentication fails when using AuthMethods.Password #299

@buoyad

Description

@buoyad

This issue is very similar to issue #107, here is my user service:

import { Injectable } from '@angular/core';
import { AngularFire, FirebaseAuth } from 'angularfire2';

@Injectable()
export class UserService {
  public db: any;
  constructor(private af: AngularFire, private auth: FirebaseAuth) { }

  signUp(email: string, password: string) {
    var creds: any = {email: email, password: password};
    this.af.auth.createUser(creds);
  }

  login(email: string, password: string) {
    var creds: any = {email: email, password: password};
    this.af.auth.login(creds).then(result => { });
  }
}

createUser() works fine, login() throws the error Error: Uncaught (in promise): You must include credentials to use this auth method.

My configuration:

import { bootstrap } from '@angular/platform-browser-dynamic';
import { MyApp } from './app/';
import { 
  FIREBASE_PROVIDERS,
  defaultFirebase,
  AngularFire,
  AuthMethods,
  AuthProviders,
  firebaseAuthConfig } from 'angularfire2';
import { UserService } from './app/user.service'

bootstrap(MyApp, [
  FIREBASE_PROVIDERS,
  defaultFirebase({
    ...
  }),
  firebaseAuthConfig({
    provider: AuthProviders.Password,
    method: AuthMethods.Password
  }),
  UserService
]);

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions