'Firebase Auth with Google Redirect back with error Unhandled Promise Rejection: TypeError: Right side of assignment cannot be destructured

im using firebase auth with google and facebook, everything works but on iOS. i use remote debugging with safari and it returned me error Unhandled Promise Rejection: TypeError: Right side of assignment cannot be destructured. here is how i get my redirect result.

import {
        initializeApp
    } from "https://www.gstatic.com/firebasejs/9.3.0/firebase-app.js";

    const firebaseConfig = {
        apiKey: "###",
        authDomain: "###",
        projectId: "###",
        storageBucket: "###",
        messagingSenderId: "###",
        appId: "###"
    };
    const app = initializeApp(firebaseConfig);

    import {
        getAuth,
        getRedirectResult
    } from "https://cdnjs.cloudflare.com/ajax/libs/firebase/9.3.0/firebase-auth.min.js";

    const auth = getAuth();

    getRedirectResult(auth)
            .then((result) => {
                const user = result.user;
                // some codes
            }).catch((error) => {
                const errorCode = error.code;
                const errorMessage = error.message;
                alert(errorMessage)
            });


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source