Ionic 2:使用Firebase通过Instagram进行身份验证

时间:2017-03-07 11:26:50

标签: javascript angular firebase firebase-authentication

我正在尝试使用Firebase集成对Instagram进行身份验证,遵循JS示例here

我已使用

app.component.ts中设置了Firebase
import * as firebase from 'firebase';

似乎有效。

home.html上我只有一个登录按钮:

<button ion-button (click)="connect()">Login</button>

home.ts上调用此内容。

connect(){
    console.log("Connecting")
    window.open('http://localhost:8080/redirect', 'firebaseAuth', 'height=315,width=400');
}

现在是我有点困惑的地方。登录成功,弹出Instagram关闭,就像Firebase示例中显示的 node 服务器一样。

然后我在构造函数中进行了变化检测:

  this.zone.run(() => {
    this.checkAuth()
  });

使用this.checkAuth():

firebase.auth().onAuthStateChanged(function(user) {
        if (user) {
          // User is signed in.
          console.log('Connect:', user);
        } else {
          // No user is signed in.
          console.log('No connect:');
        }
      });

关闭窗口后控制台中没有任何内容。但是我很确定我错过了什么。 任何帮助非常感谢。 谢谢!

0 个答案:

没有答案