Microsoft Authentication via Firebase not working on some devices

I have intergrated microsoft authentication into my android app via firebase, I as well have the app registered on Microsoft Entra Id with the correct app id and redirect Uris registered on both ends. The authentication works fine on most devices however on my lg g6 running android 9 when i click login and a chrome tab is opened i have to click more option at the top and then select run in chrome for the authentication flow to work, however on another device a xiamo redmi note 9 pro running android 10 and MIUI 12 i completely cannot log in to the application and get an error message from firebase stating “The web operation was canceled by the user.”

Here is my login fragment code

class LoginFragment : Fragment(R.layout.fragment_login_2) {

    private lateinit var binding: FragmentLogin2Binding
    private lateinit var animationView: LottieAnimationView
    private lateinit var dialog: AlertDialog

    private val viewModel by viewModels<LoginViewModel>()

    private val firebaseAuth by lazy {
        FirebaseAuth.getInstance()
    }

    private val provider by lazy {
        OAuthProvider.newBuilder("microsoft.com").apply {
            //Force re-consent
            addCustomParameter("prompt", "consent")
            //Target specific email with login hint
            addCustomParameter("tenant", "55cc3b83-0fa3-49c7-8c49-14b9ccdfd9ff")
        }.build()

    }

    override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
        super.onViewCreated(view, savedInstanceState)

        // Handle the intent
        handleIntent(requireActivity().intent)

        binding = FragmentLogin2Binding.bind(view)

        if (firebaseAuth.currentUser != null)
            navigate()

        binding.canUseBiometric = BiometricUtil.isBiometricSet(requireContext())


        //re-enable status bar for login screen
        requireActivity().window.decorView.systemUiVisibility = View.VISIBLE

        initializeViews()

        viewModel.isLoginSuccess.observe(viewLifecycleOwner, Observer { success ->
            if (success) {
                try {
                    dialog.dismiss()
                    navigate()
                } catch (e: Exception) {
                    Timber.e(e.message)
                }
            } else {
                Dialog.show(requireContext(), ErrorContent(viewModel.errorMessage.value.toString()))
            }
        })

        binding.btnLogin.setOnClickListener {

            val firebaseUser = firebaseAuth.currentUser
            Timber.d("current user $firebaseUser")

            if (!hasOnGoingRegistration())
                appLogin()
        }
    }

    private fun initializeViews() {
        animationView = binding.loginAnimation
        animationView.playAnimation()
    }

    private fun hasOnGoingRegistration(): Boolean {
        val pending = firebaseAuth.pendingAuthResult ?: return false
        pending.addOnSuccessListener {
            navigate()
        }.addOnFailureListener {
            it.message?.let { it1 -> ErrorContent(it1) }
                ?.let { it2 -> Dialog.show(requireContext(), it2) }
        }

        return true
    }

    private fun appLogin() {
        Dialog.show(requireContext(), LoadingContent(""))

        firebaseAuth
            .startActivityForSignInWithProvider(requireActivity(), provider)
            .addOnSuccessListener {
                //User is signed in
                navigate()
                Timber.d("User has successfully been authenticated")
            }
            .addOnFailureListener {
                it.printStackTrace()
                //Handle failure an error was encountered
                Timber.d("error authenticating ${it.cause}")
                it.message?.let { it1 -> ErrorContent(it1) }
                    ?.let { it2 -> Dialog.show(requireContext(), it2) }
            }
    }

    private fun handleIntent(intent: Intent?) {
        intent?.data?.let { uri ->
            // Extract data from the redirect URI
            val code = uri.getQueryParameter("code")
            val error = uri.getQueryParameter("error")

            // Handle the authentication response
            if (code != null) {
                // Authorization code received, complete the authentication process
                // You can exchange the authorization code for an access token here
                Toast.makeText(requireContext(), "Success", Toast.LENGTH_LONG).show()
            } else if (error != null) {
                // An error occurred during the authentication process
                // Handle the error appropriately
                Toast.makeText(requireContext(), "Error", Toast.LENGTH_LONG).show()
            }
        }
    }


    private fun navigate() {
        val intent = Intent(context, HomeActivity::class.java)
        intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP or Intent.FLAG_ACTIVITY_SINGLE_TOP)
        startActivity(intent)
    }


    override fun onResume() {
        super.onResume()
        hasOnGoingRegistration()
    }
}```

Could anyone offer any insight or suggestions into how i can resolve this?

Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa Dịch vụ tổ chức sự kiện 5 sao Thông tin về chúng tôi Dịch vụ sinh nhật bé trai Dịch vụ sinh nhật bé gái Sự kiện trọn gói Các tiết mục giải trí Dịch vụ bổ trợ Tiệc cưới sang trọng Dịch vụ khai trương Tư vấn tổ chức sự kiện Hình ảnh sự kiện Cập nhật tin tức Liên hệ ngay Thuê chú hề chuyên nghiệp Tiệc tất niên cho công ty Trang trí tiệc cuối năm Tiệc tất niên độc đáo Sinh nhật bé Hải Đăng Sinh nhật đáng yêu bé Khánh Vân Sinh nhật sang trọng Bích Ngân Tiệc sinh nhật bé Thanh Trang Dịch vụ ông già Noel Xiếc thú vui nhộn Biểu diễn xiếc quay đĩa Dịch vụ tổ chức tiệc uy tín Khám phá dịch vụ của chúng tôi Tiệc sinh nhật cho bé trai Trang trí tiệc cho bé gái Gói sự kiện chuyên nghiệp Chương trình giải trí hấp dẫn Dịch vụ hỗ trợ sự kiện Trang trí tiệc cưới đẹp Khởi đầu thành công với khai trương Chuyên gia tư vấn sự kiện Xem ảnh các sự kiện đẹp Tin mới về sự kiện Kết nối với đội ngũ chuyên gia Chú hề vui nhộn cho tiệc sinh nhật Ý tưởng tiệc cuối năm Tất niên độc đáo Trang trí tiệc hiện đại Tổ chức sinh nhật cho Hải Đăng Sinh nhật độc quyền Khánh Vân Phong cách tiệc Bích Ngân Trang trí tiệc bé Thanh Trang Thuê dịch vụ ông già Noel chuyên nghiệp Xem xiếc khỉ đặc sắc Xiếc quay đĩa thú vị
Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa
Thiết kế website Thiết kế website Thiết kế website Cách kháng tài khoản quảng cáo Mua bán Fanpage Facebook Dịch vụ SEO Tổ chức sinh nhật