Closed arushgupta2007 closed 3 years ago
interesting, I offen use signin with popup, which case do you need to signin with redirect?
this capacitor plugin using signin with popup: https://github.com/baumblatt/capacitor-firebase-auth/blob/master/src/providers/facebook.provider.ts
Hi, Sorry for late reply. I had tried both sign in with popup and sign in with redirect I am using a library which supports only cordova, so I cannot use capacitor. Thanks
I got the same issue.
In the Firebase docs @https://firebase.google.com/docs/auth/web/cordova I found this:
Note: If you are using the Ionic framework, the latest version of that framework should be used to ensure the app is served from origins with the file:// or ionic:// scheme. This is required so that Firebase Auth can properly handle signInWithRedirect operations. Firebase Auth will treat http://localhost origins as web-based browser apps even if they are rendered in a Cordova environment.
Tried to change the Scheme in config.xml adding to the android platform section
<preference name="Scheme" value="ionic" />
but this broke the app.
Any idea ?
Thanks
closing as it doesn't appear to be an AngularFire bug, feel free to continue discussions however
Version info
Angular:
Firebase:
"firebase": "^7.17.1" (package.json)
AngularFire:
"angularfire2": "^5.4.2" (package.json)
Other (e.g. Ionic/Cordova, Node, browser, operating system): Output of Ionic info
How to reproduce these conditions
Hi, I am using Ionic, cordova. I would like to add user authentication in it.
this.afAuth.signInWithRedirect(new firebase.auth.GoogleAuthProvider())
works, it opens the browser at<firebase-project-name>.firebaseapp.com
but after I have signed in, it redirects tolocalhost/sign-in
in the chrome browser (which of course gives a 404), I would like it to redirect it to my app, with the user data (currently user data has not reached my app).Steps to set up and reproduce
create a blank ionic, cordova, angular app
run
npm install @angular/fire firebase
create a new firebase project, say it is
example_firebase_project
add a web app to the firebase project
get the firebaseConfig and add it in your environments.ts file
in
app.module.ts
add the following:@NgModule({ declarations: [AppComponent, ...], entryComponents: [], imports: [ ... AngularFireModule.initializeApp(environment.firebaseConfig), AngularFireDatabaseModule, AngularFireAuthModule ], providers: [ ... AngularFireDatabase, ], })
ionic cordova plugin add cordova-plugin-buildinfo --save ionic cordova plugin add cordova-universal-links-plugin-fix --save ionic cordova plugin add cordova-plugin-browsertab --save ionic cordova plugin add cordova-plugin-inappbrowser --save
<preference name="AndroidLaunchMode" value="singleTask" />
Expected behaviour
After sign in, It redirects back to app
Actual behaviour
After sign in, it redirects to url:
localhost/login
in the chrome browser