我正在尝试使用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:');
}
});
关闭窗口后控制台中没有任何内容。但是我很确定我错过了什么。 任何帮助非常感谢。 谢谢!