Authentication Email/Password with Firebase sdk3 and Angularfire2
<p>I am new to Firebase, but I want to use it in my current angular2 project. I am stuck with Email-Password-Authentication using <a href="https://github.com/angular/angularfire2" rel="nofollow">Angularfire2</a>. As far as I do understand the API you have to call the <code>signInWithEmailAndPassword(email, password)</code> method of the <code>firebase.auth.Auth</code> object. I don't know how to get an instance of this 'Auth', though. 
I did find an <a href="https://github.com/r-park/todo-angular2-firebase/blob/master/src/core/auth/auth-service.ts" rel="nofollow">example</a> for authentication in general. But the example does not use email/password authentication. I cannot find any example on how to call the aforementioned method in the right way. </p>

<p>I did find some JS-Examples. There, the 'Auth'-Object is injected somehow. This does not seem to work the way I tried it. This is what i got so far (not working):</p>

<p>main.ts</p>

<pre><code>bootstrap(AppComponent, [..., FIREBASE_PROVIDERS,
defaultFirebase({
    apiKey: "&lt;&gt;",
    authDomain: "&lt;&gt;",
    databaseURL: "&lt;&gt;",
    storageBucket: "&lt;&gt;",
}),firebaseAuthConfig({
    provider: AuthProviders.Password,
    method: AuthMethods.Password
}), AuthService])
.catch(err =&gt; console.error(err));
</code></pre>

<p>auth.service.ts:</p>

<pre><code>@Injectable()
export class AuthService{

private _authState: FirebaseAuthState = null;

constructor(private _fireAuth:FirebaseAuth, private _af:AngularFire, private _auth:Auth){
    _fireAuth.subscribe( (state:FirebaseAuthState) =&gt;{
        this._authState = state;
    });
}

get authenticated():boolean{
    return this._authState !== null;
}

get id(): string {
    return this.authenticated ? this._authState.uid : '';
}

signIn(email:string, password:string):Promise&lt;User&gt;{
    return this._auth.signInWithEmailAndPassword(email, password);
}
...
</code></pre>

<p>My App does not even start -> Error <code>Cannot resolve all parameters for 'AuthService'(FirebaseAuth, AngularFire, ?)</code>. 
If I try to use <code>this._af.auth().signInWithEmailAndPassword(email, password)</code> the Typescript compiler complains: <code>error TS2349: Cannot invoke an expression whose type lacks a call signature.</code> Ignoring the compiler error and running the program results in an error <code>TypeError: this._af.auth is not a function</code>.</p>

<p>Thank you for your help!</p>

<p><code>#AskFirebase</code></p>