Skip to content

Instantly share code, notes, and snippets.

@zinyando
Last active May 4, 2017 15:53
Show Gist options
  • Save zinyando/5a5e5a6a5c59dcd1ab8351dead7aa62f to your computer and use it in GitHub Desktop.
Save zinyando/5a5e5a6a5c59dcd1ab8351dead7aa62f to your computer and use it in GitHub Desktop.
import {Injectable, OnInit, NgZone} from '@angular/core';
import {AuthInterface} from './auth';

var provider = new firebase.auth.GithubAuthProvider();

@Injectable()
export class AuthService implements AuthInterface {
    constructor(private ngZone : NgZone) {}

    public isAuthenticated : boolean;

    public open() {
        firebase.auth().signInWithPopup(provider).then((result) => {
                this.ngZone.run(() => {
                
                        ...
                        
                        this.isAuthenticated = true;
                    });
            });
    }
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment