Authenticate Using OAuth Providers with Cordova
I’m following this step by step but it’s not working
Might be an idea to drop them a message or use their forum/chat.
Do you have any examples using oauth?
LaurentPayot last edited by
I use Firebase OAuth without problems but I didn’t try with Cordova yet. I will try soon and tell you.
It’s working fine for me on an android virtual device (API 24) as well as on my android 6 phone.
@sostenesfreitas What is not working exactly?
@LaurentPayot What was your setup?
Following the instructions here:
quasar dev -m cordova -T android
It seems to be redirecting the dev server URL in a new browser window (rather than the actual app).
const provider = new firebase.auth.GoogleAuthProvider()
opens a new browser to the google oauth page, but then redirects to the dev server URL (instead reopening the app).
I strongly suspect this has to with the way Quasar does hot reload (which fricking awesome btw!).
If I run:
quasar build -m cordova -T android
Then download the app, .auth.signInWithRedirect(provider) works as expected.
Does anyone know how to do OAuth in a cordova dev build on android?
@driedler I took the PWA train months ago. But I remember I had some issue with Cordova and firebase OAuth. I had to call
createdhook of my component where the authentication takes place, because the app was destroyed before sign-in was complete, so a new app was created after authentication and getRedirectResult() had to be called asap.
Hope it helps…
Also maybe this is an issue as Cordova uses WebView if I’m right: https://developers.googleblog.com/2016/08/modernizing-oauth-interactions-in-native-apps.html
@driedler If someone still facing the problem, it is resolved with two lines in cordova’s config.xml file:
<preference name="OverrideUserAgent" value="Mozilla/5.0 Google" /> <allow-navigation href="*" />