How to use the angularfire2.AuthProviders.Facebook function in angularfire2

To help you get started, we’ve selected a few angularfire2 examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github weolopez / BraveHackersSpring2016 / app / app.ts View on Github external
firebaseAuthConfig,
    AuthProviders,
    AuthMethods
} from 'angularfire2';

@App({
    templateUrl: 'build/app.html',
    config: {}, // http://ionicframework.com/docs/v2/api/config/Config/ 
    providers: [
        Story,
        User,
        Beacons,
        FIREBASE_PROVIDERS,
        defaultFirebase('https://aofs.firebaseio.com/'),
        firebaseAuthConfig({
            provider: AuthProviders.Facebook,
            method: AuthMethods.Popup,
            remember: 'default',
            scope: ['email']
        })
    ]
})
class MyApp {
    // make HelloIonicPage the root (or first) page 
    rootPage: any = Start;
    pages: Array<{ title: string, component: any }>;

    constructor(
        private app: IonicApp,
        private platform: Platform,
        private menu: MenuController
    ) {
github weolopez / BraveHackersSpring2016 / app / models / user / user.ts View on Github external
public doLogin() {
        var start = this;
        // This will perform popup auth with google oauth and the scope will be email
        // Because those options were provided through bootstrap to DI, and we're overriding the provider.
        this.auth.login({
            provider: AuthProviders.Facebook
        }).then(function(value) {
            start.firebaseAuthState = value;
        });;
    }
    public doLogout() {
github rodrigoreal / ionic3-angularfire-login / src / providers / auth.ts View on Github external
let provider = firebase.auth.FacebookAuthProvider.credential(facebookData.authResponse.accessToken);
          firebase.auth().signInWithCredential(provider).then(firebaseData => {
            this.af.database.list('users').update(firebaseData.uid, {
              name: firebaseData.displayName,
              email: firebaseData.email,
              provider: 'facebook',
              image: firebaseData.photoURL
            });
            observer.next();
          });
        }, error => {
          observer.error(error);
        });
      } else {
        this.af.auth.login({
          provider: AuthProviders.Facebook,
          method: AuthMethods.Popup
        }).then((facebookData) => {
          this.af.database.list('users').update(facebookData.auth.uid, {
            name: facebookData.auth.displayName,
            email: facebookData.auth.email,
            provider: 'facebook',
            image: facebookData.auth.photoURL
          });
          observer.next();
        }).catch((error) => {
          console.info("error", error);
          observer.error(error);
        });
      }
    });
  }
github designcourse / angularfire2-chat / src / app / app.component.ts View on Github external
login() {
    this.af.auth.login({
      provider: AuthProviders.Facebook,
      method: AuthMethods.Popup
    })
  }
github aviabird / pinterest / src / app / services / authentication.ts View on Github external
private _getProvider(from: string) {
    switch(from){
      case 'twitter': return AuthProviders.Twitter;
      case 'facebook': return AuthProviders.Facebook;
      case 'github': return AuthProviders.Github;
      case 'google': return AuthProviders.Google;
    }
  }
}
github anihalaney / rwa-trivia / src / app / core / components / login / login.component.spec.ts View on Github external
(dialog: MatDialog, af: AngularFire, dRef: MatDialogRef) => {

    let spy = spyOn(af.auth, "login");
    fixture.detectChanges();

    let deButtons = fixture.debugElement.queryAll(By.css('button'));

    deButtons[0].triggerEventHandler('click', null);
    expect(af.auth.login).toHaveBeenCalled();
    expect(spy.calls.mostRecent().args[0].provider).toBe(AuthProviders.Google, 'Provider Google');
    expect(spy.calls.mostRecent().args[0].method).toBe(AuthMethods.Popup, 'Method Popup');

    deButtons[1].triggerEventHandler('click', null);
    expect(af.auth.login).toHaveBeenCalled();
    expect(spy.calls.mostRecent().args[0].provider).toBe(AuthProviders.Facebook, 'Provider Facebook');
    expect(spy.calls.mostRecent().args[0].method).toBe(AuthMethods.Popup, 'Method Popup');

    deButtons[2].triggerEventHandler('click', null);
    expect(af.auth.login).toHaveBeenCalled();
    expect(spy.calls.mostRecent().args[0].provider).toBe(AuthProviders.Twitter, 'Provider Twitter');
    expect(spy.calls.mostRecent().args[0].method).toBe(AuthMethods.Popup, 'Method Popup');

    deButtons[3].triggerEventHandler('click', null);
    expect(af.auth.login).toHaveBeenCalled();
    expect(spy.calls.mostRecent().args[0].provider).toBe(AuthProviders.Github, 'Provider Github');
    expect(spy.calls.mostRecent().args[0].method).toBe(AuthMethods.Popup, 'Method Popup');

    let spy2 = spyOn(dialog, "open")
            .and.callFake((type: any, options: any) => {
              expect(typeof type).toEqual("function");
              expect(options.disableClose).toEqual(false);
github sdey0081 / ionic-messenger-starter / src / providers / auth.service.ts View on Github external
private signInWithFacebook() {
    if (!this.platform.is('cordova'))
      return this.signInWithProvider(AuthProviders.Facebook);
    
    return Facebook.login(['email', 'public_profile'])
      .then(res => {
        return this.signInWithCredential(firebase.auth.FacebookAuthProvider.credential(res.authResponse.accessToken));
      }, (error) => Promise.reject(error));
  }
github cjsheets / angular-voting-app / src / app / navbar / auth.service.ts View on Github external
getAuthProvider(provider: string): {} {
    var authProvider = {method: AuthMethods.Redirect};
    switch (provider){
      case 'Google': authProvider['provider'] = AuthProviders.Google; break;
      case 'Github': authProvider['provider'] = AuthProviders.Github; break;
      case 'Facebook': authProvider['provider'] = AuthProviders.Facebook; break;
      case 'Twitter': authProvider['provider'] = AuthProviders.Twitter; break;
      default: return '{}';
    }
    return authProvider;
  }