No More Posting New Topics!

If you have a question or an issue, please start a thread in our Github Discussions Forum.
This forum is closed for new threads/ topics.

Navigation

    Quasar Framework

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search

    Authenticate Using OAuth Providers with Cordova

    Help
    5
    9
    3309
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • S
      sostenesfreitas last edited by

      I’m following this step by step but it’s not working

      https://firebase.google.com/docs/auth/web/cordova

      1 Reply Last reply Reply Quote 1
      • rstoenescu
        rstoenescu Admin last edited by

        Might be an idea to drop them a message or use their forum/chat.

        1 Reply Last reply Reply Quote 0
        • S
          sostenesfreitas last edited by

          Do you have any examples using oauth?

          1 Reply Last reply Reply Quote 0
          • LaurentPayot
            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.

            1 Reply Last reply Reply Quote 0
            • LaurentPayot
              LaurentPayot last edited by LaurentPayot

              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?

              1 Reply Last reply Reply Quote 0
              • D
                driedler last edited by

                @LaurentPayot What was your setup?

                Following the instructions here:
                https://firebase.google.com/docs/auth/web/cordova

                Using Quasar-0.15.14

                and running:
                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).

                Running:
                const provider = new firebase.auth.GoogleAuthProvider()
                self.auth.signInWithRedirect(provider)
                return self.auth.getRedirectResult()

                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?

                LaurentPayot Y 2 Replies Last reply Reply Quote 0
                • LaurentPayot
                  LaurentPayot @driedler last edited by LaurentPayot

                  @driedler I took the PWA train months ago. But I remember I had some issue with Cordova and firebase OAuth. I had to call auth.getRedirectResult() at the created hook 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…

                  1 Reply Last reply Reply Quote 0
                  • LaurentPayot
                    LaurentPayot last edited by LaurentPayot

                    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

                    1 Reply Last reply Reply Quote 0
                    • Y
                      Y.Zin @driedler last edited by Y.Zin

                      @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="*" />
                      

                      Thanks to this topic https://stackoverflow.com/questions/50263489/firebase-cordova-google-login-not-working

                      1 Reply Last reply Reply Quote 0
                      • First post
                        Last post