I’m trying to authenticate Instagram with a Firebase integration, following the JS example here.
I have set up Firebase in app.component.ts
using
import * as firebase from 'firebase';
which has seemingly worked.
On home.html
I simply have a login button:
<button ion-button (click)="connect()">Login</button>
Which calls this on home.ts
.
connect(){
console.log("Connecting")
window.open('http://localhost:8080/redirect', 'firebaseAuth', 'height=315,width=400');
}
Now is where I’m a little confused. The log in is successful, and the pop-up Instagram closes as should happen with the node server shown in Firebase’s example.
I then have, in the constructor, for change detection:
this.zone.run(() => {
this.checkAuth()
});
With 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:');
}
});
Nothing appears in console after window close. However I’m pretty sure I’m missing something.
Any help greatly appreciated.
Thank you!