firebase / flutterfire

🔥 A collection of Firebase plugins for Flutter apps.
https://firebase.google.com/docs/flutter/setup
BSD 3-Clause "New" or "Revised" License
8.68k stars 3.97k forks source link

FlutterFire: <Platform Exception:12500> #13551

Open Anurag-Dubey12 opened 2 days ago

Anurag-Dubey12 commented 2 days ago

Is there an existing issue for this?

Which plugins are affected?

Core

Which platforms are affected?

Android

Description

Encountered a PlatformException (error code 12500) while trying to authenticate with ifrebase after using FlutterFire. Expected successful authentication, but the error persists, leading to a failed sign-in attempt. Tried various approaches, but the issue remains unresolved. what i am also facing is if leave the screen for few minute then again try to login it sign in successfully but when in the starting it just show these issue i don't know what is the exact issue and why i am facing these

Reproducing the issue

i had setup flutterfire ,also checked that sha1 key is proper also enable google sign in provider

Firebase Core version

2.15.1

Flutter Version

3.24.3

Relevant Log Output

No response

Flutter dependencies

dependencies: get: ^5.0.0-release-candidate-6 pin_code_fields: ^8.0.1 flutter: sdk: flutter

cupertino_icons: ^1.0.2 flutter_svg: ^2.0.7 device_preview: ^1.1.0 logger: ^2.0.1 firebase_auth: ^4.8.0 google_sign_in: ^6.1.4 firebase_core: ^2.15.1 json_annotation: ^4.9.0 intl: any image_picker: ^1.0.5 google_maps_flutter: ^2.5.0 google_places_flutter: ^2.0.6 mime: ^1.0.4 http: ^1.2.1 permission_handler: ^11.0.1 geolocator: ^12.0.0 cached_network_image: ^3.3.1 geocoding: ^2.1.1 shared_preferences: ^2.3.2 socket_io_client: ^2.0.3+1 flutter_widget_from_html: ^0.14.11 firebase_messaging: ^14.7.10 get_storage: ^2.1.1 flutter_native_contact_picker: ^0.0.5 flutter_cache_manager: ^3.3.1 restart_app: ^1.2.1 carousel_slider: ^5.0.0 url_launcher: ^6.2.5 firebase_crashlytics: ^3.4.18 share_plus: ^7.2.2 package_info_plus: ^6.0.0 app_links: ^4.0.1 connectivity_widget: ^2.0.0 photo_view: ^0.14.0 smooth_page_indicator: any persistent_bottom_nav_bar: ^6.2.1 iconsax: ^0.0.8 flutter_localizations: sdk: flutter razorpay_flutter: ^1.3.0

flutter_media_downloader: ^1.0.4

connectivity_plus: ^6.0.1

Additional context and comments

No response

SelaseKay commented 2 days ago

Hi @Anurag-Dubey12, kindly provide a sample minimal code reproducing this issue.

Anurag-Dubey12 commented 1 day ago
import 'dart:io';

import 'package:flutter/gestures.dart';
import 'package:flutter/material.dart';
import 'package:flutter_gen/gen_l10n/app_localizations.dart';
import 'package:get/get.dart';
import 'package:gully_app/data/controller/auth_controller.dart';
import 'package:gully_app/ui/screens/home_screen.dart';

import 'legal_screen.dart';

class SignUpScreen extends StatefulWidget {
  const SignUpScreen({super.key});

  @override
  State<SignUpScreen> createState() => _SignUpScreenState();
}

class _SignUpScreenState extends State<SignUpScreen> {
  @override
  Widget build(BuildContext context) {
    final controller = Get.find<AuthController>();
    return DecoratedBox(
      decoration: const BoxDecoration(
        color: Colors.white,
        image: DecorationImage(
            image: AssetImage(
              'assets/images/sports_icon.png',
            ),
            fit: BoxFit.cover),
      ),
      child: DecoratedBox(
        decoration: const BoxDecoration(
          gradient: LinearGradient(
            colors: [
              Color(0xff3F5BBF),
              Color(0xff3F5BBF),
              Color(0xffEEEFF5),
              Color(0xffEEEFF5),
              Colors.transparent
            ],
            begin: Alignment.topCenter,
            end: Alignment.bottomCenter,
          ),
        ),
        child: Scaffold(
          backgroundColor: Colors.transparent,
          body: Padding(
            padding: const EdgeInsets.all(18.0),
            child: Column(
              mainAxisAlignment: MainAxisAlignment.spaceEvenly,
              children: [
                const Spacer(),
                Column(
                  children: [
                    Image.asset(
                      'assets/images/logo.png',
                      scale: 3.2,
                    ),
                    Image.asset(
                      'assets/images/logo_shadow.png',
                      scale: 3,
                    ),
                  ],
                ),

                const Spacer(), const Spacer(),
                FittedBox(
                  child: Text(
                    '${AppLocalizations.of(context)!.signup}/ ${AppLocalizations.of(context)!.login}',
                    style: Get.textTheme.titleLarge,
                  ),
                ),
                const Spacer(),
                // create a container sign up with google
                const SizedBox(height: 15),
                Obx(
                  () {
                    if (controller.status.isLoading) {
                      return const CircularProgressIndicator();
                    } else {
                      return SocialButton(
                        image: 'google_icon.png',
                        title: AppLocalizations.of(context)!.signupgoogle,
                        bgColor: Colors.white,
                        color: const Color.fromRGBO(0, 0, 0, 0.54),
                        onClick: () async {
                          final res = await controller.loginViaGoogle();
                          if (res) {
                            Get.offAll(() => const HomeScreen());
                          }
                        },
                      );
                    }
                  },
                ),

                const SizedBox(height: 30),
                Platform.isIOS
                    ? SocialButton(
                        image: 'apple_icon.png',
                        title: AppLocalizations.of(context)!.signupapple,
                        bgColor: Colors.black,
                        color: Colors.white,
                        onClick: () {},
                      )
                    : const SizedBox(),
                const Spacer(),
                const Spacer(),

                RichText(
                  textAlign: TextAlign.center,
                  text: TextSpan(
                      text: "${AppLocalizations.of(context)!.by_continuing}\n ",
                      children: [
                        TextSpan(
                            text:
                                AppLocalizations.of(context)!.terms_of_service,
                            recognizer: TapGestureRecognizer()
                              ..onTap = () {
                                Get.bottomSheet(BottomSheet(
                                    onClosing: () {},
                                    builder: (builder) => LegalViewScreen(
                                          title: AppLocalizations.of(context)!
                                              .terms_of_service,
                                          slug: 'terms',
                                          hideDeleteButton: true,
                                        )));
                              },
                            style: TextStyle(
                                color: Colors.blue.shade700,
                                fontWeight: FontWeight.w500)),
                        TextSpan(
                            text: AppLocalizations.of(context)!.and,
                            recognizer: TapGestureRecognizer()
                              ..onTap = () {
                                Get.bottomSheet(BottomSheet(
                                    onClosing: () {},
                                    builder: (builder) => LegalViewScreen(
                                          title:
                                              '${AppLocalizations.of(context)!.privacy_policy} ',
                                          slug: 'privacy',
                                          hideDeleteButton: true,
                                        )));
                              },
                            style: const TextStyle()),
                        TextSpan(
                            text:
                                " ${AppLocalizations.of(context)!.privacy_policy}",
                            recognizer: TapGestureRecognizer()
                              ..onTap = () {
                                Get.bottomSheet(BottomSheet(
                                    onClosing: () {},
                                    builder: (builder) => LegalViewScreen(
                                          title: AppLocalizations.of(context)!
                                              .privacy_policy,
                                          slug: 'privacy',
                                          hideDeleteButton: true,
                                        )));
                              },
                            style: TextStyle(
                                color: Colors.blue.shade700,
                                fontWeight: FontWeight.w500))
                      ],
                      style:
                          const TextStyle(color: Colors.black, fontSize: 13)),
                ),
                const SizedBox(height: 14),
              ],
            ),
          ),
        ),
      ),
    );
  }
}

class SocialButton extends StatelessWidget {
  final String image;
  final String title;
  final Color bgColor;
  final Color color;
  final VoidCallback onClick;

  const SocialButton({
    super.key,
    required this.image,
    required this.title,
    required this.bgColor,
    required this.color,
    required this.onClick,
  });

  @override
  Widget build(BuildContext context) {
    return InkWell(
      onTap: () => onClick.call(),
      child: Container(
        width: double.infinity,
        height: 50,
        decoration: BoxDecoration(
          borderRadius: BorderRadius.circular(10),
          color: bgColor,
          boxShadow: [
            BoxShadow(
              color: Colors.black.withOpacity(0.1),
              blurRadius: 10,
              offset: const Offset(0, 5),
            ),
          ],
        ),
        child: Row(
          mainAxisAlignment: MainAxisAlignment.center,
          children: [
            Image.asset(
              'assets/images/$image',
              scale: 3,
            ),
            const SizedBox(
              width: 10,
            ),
            Text(
              title,
              style: Get.textTheme.headlineMedium?.copyWith(color: color),
            ),
          ],
        ),
      ),
    );
  }
}
SelaseKay commented 1 day ago

Hi @Anurag-Dubey12, could you provide a minimal reproducible example without third-party libraries to help isolate the issue? You can create a new repository with sample code that reproduces the problem and share the link here. How to create a Minimal, Reproducible Example.