Ad

Firebase Auth To Sign-in Google Not Working In Framework7

I have setup Firebase admin structure and generate all required id, key and token. With Firebase email and password auth it works fine. But when implementing Google signin it fails. Please help.

index.html code

`<a target="_blank" rel="nofollow noreferrer" href="#" class="googleplus" onclick="firebaselogin()"><i class="icon fab fa-google-plus-g"></i></a>`
<script src="js/firebase.js"></script>
<script src="js/firebase-auth.js"></script>
<script>
  // Initialize Firebase
  var configfirebase = {
    apiKey: "***********************",
    authDomain: "*****************.firebaseapp.com",
    databaseURL: "https://f*************.firebaseio.com",
    projectId: "************",
    storageBucket: "************",
    messagingSenderId: "**********",
  };
  firebase.initializeApp(configfirebase);
</script>

registration.js code

var provider = new firebase.auth.GoogleAuthProvider();
function firebaselogin() {
  firebase.auth().signInWithRedirect(provider).then(function() {
          return firebase.auth().getRedirectResult();
        }).then(function(result) {
          var token = result.credential.accessToken;
          var user = result.user;
         app.dialog.alert('Login success!! Welcome:' + result.user );
        }).catch(function(error) {
          var errorCode = error.code;
          var errorMessage = error.message;
         app.dialog.alert('Login error!! error:' + errorMessage );

        });
}

When I run the app I get this error.enter image description here

Ad

Answer

I have fixed that issue by just placing the firebase-app js to top.

Ad
source: stackoverflow.com
Ad