seeschweiler / angular-firebase-authentication-sample

Angular 2 Firebase Authentication
6 stars 12 forks source link

Cannot import module from angularfire2 #1

Open sittidetj opened 6 years ago

sittidetj commented 6 years ago

Hello, my name is SJ. I try with your document. But it show error when I import ==> { AngularFire, AuthProviders, AuthMethods } from 'angularfire2'; Do you have any update ?

Thank you.

anson-vandoren commented 6 years ago

@sittidetj this was written for an older version of angularfire2. There is some updated documentation at: https://github.com/angular/angularfire2/blob/master/docs/5-user-authentication.md

The way I implemented this was:

import { Injectable } from '@angular/core';

import { AngularFireAuth } from 'angularfire2/auth';
import * as firebase from 'firebase/app';

@Injectable()
export class AuthService {

    constructor(public afAuth: AngularFireAuth) { }

    loginWithGoogle() {
        return this.afAuth.auth.signInWithPopup(new firebase.auth.GoogleAuthProvider());
    }

    logout() {
      return this.afAuth.auth.signOut();
    }

}

Hope that helps

sittidetj commented 6 years ago

Dear Team

Thank you for information.

SJ.

On 14Aug, 2560 BE, at 10:48 AM, Anson VanDoren notifications@github.com wrote:

@sittidetj https://github.com/sittidetj this was written for an older version of angularfire2. There is some updated documentation at: https://github.com/angular/angularfire2/blob/master/docs/5-user-authentication.md https://github.com/angular/angularfire2/blob/master/docs/5-user-authentication.md The way I implemented this was:

import { Injectable } from '@angular/core';

import { AngularFireAuth } from 'angularfire2/auth'; import * as firebase from 'firebase/app';

@Injectable() export class AuthService {

constructor(public afAuth: AngularFireAuth) { }

loginWithGoogle() {
    return this.afAuth.auth.signInWithPopup(new firebase.auth.GoogleAuthProvider());
}

logout() {
  return this.afAuth.auth.signOut();
}

} Hope that helps

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/seeschweiler/angular-firebase-authentication-sample/issues/1#issuecomment-322094075, or mute the thread https://github.com/notifications/unsubscribe-auth/ADjQrRBfjtq-K-vBJII5g_HQTDrDkAmmks5sX8OjgaJpZM4OnReO.