Alexander
Alexander

Reputation: 115

Angular + Firebase + Cordova google auth

I have a ready-made web application on Angular 10 + Firebase with Google Account authorization.

But when I made android app with cordova

angularFireAuth.signInWithPopup(provider)

It didn't work, failing with:

Error: This operation is not supported in the environment this application is running on. "location.protocol" must be http, https or chrome-extension and web storage must be enabled.

The same to angularFireAuth.signInWithRedirect(provider).

What should I use to make google auth in angular + cordova + firebase android app?

I've read https://firebase.google.com/docs/auth/web/cordova but it didn't help -- I can't install all plugins (errors appear) , and all I've read about cordova didn't help because I have main functionality in my Angular AuthService , where I'm using AngularFireAuth.

This is my first project with cordova and angularfire, so I'm stuck and I can't find the answer anywhere.

Upvotes: 2

Views: 736

Answers (1)

DaveAlden
DaveAlden

Reputation: 30356

Either use cordova-plugin-ionic-webview to load the Cordova app into the Webview using http:// instead of file://.

Or use native mobile Firebase SDK e.g. cordova-plugin-firebasex and use authenticateUserWithGoogle().

Upvotes: 1

Related Questions