Skip to content

[Firebase auth]: <Firebase Phone Authentication – OTP Expired in Production> #17853

@rajatsingh0406

Description

@rajatsingh0406

Is there an existing issue for this?

  • I have searched the existing issues.

Which plugins are affected?

Auth

Which platforms are affected?

Android

Description

Firebase Phone Authentication fails in the production (Play Store) version of the app.
When users enter the received OTP, Firebase returns the following error:

"OTP expired, request a new OTP."

This issue occurs only in the Play Store build of the Android app.
The same code works fine in:

Debug builds

Locally signed release builds

iOS builds

Affected Devices

Android versions below 15

Android 15 and above: ✅ Works fine

Expected Behavior

OTP should verify successfully if entered within the valid time period.

Actual Behavior

Firebase immediately returns “OTP expired” when verifying a valid OTP in the Play Store build.

Reproducing the issue

Steps to Reproduce

Install the app from Google Play Store

Attempt phone number login

Enter the received OTP

Observe error:

"OTP expired, request a new OTP"

Firebase Core version

4.2.1

Flutter Version

3.32.4

Relevant Log Output

Flutter dependencies

name: project_structure
description: "A new Flutter project."

The following line prevents the package from being accidentally published to

pub.dev using flutter pub publish. This is preferred for private packages.

publish_to: 'none' # Remove this line if you wish to publish to pub.dev

version: 1.0.13+14

environment:
sdk: ^3.6.0

dependencies:
flutter:
sdk: flutter

The following adds the Cupertino Icons font to your application.

Use with the CupertinoIcons class for iOS style icons.

cupertino_icons: ^1.0.8
get: ^4.7.2
flutter_screenutil: ^5.9.3
shared_preferences: ^2.5.2
provider: ^6.1.2
http: ^1.3.0
http_interceptor: ^2.0.0
firebase_messaging: ^16.0.4

flutter_local_notifications: ^18.0.1

cached_network_image: ^3.4.1
shimmer: ^3.0.0
flutter_svg: ^2.0.17
pinput: ^5.0.1
carousel_slider: ^5.0.0
firebase_core: ^4.2.1
firebase_auth: ^6.1.2
google_sign_in: ^6.3.0
flutter_facebook_auth: ^7.1.1
sign_in_with_apple: ^6.1.1
cloud_firestore: ^6.1.0
geolocator: ^13.0.1
google_maps_flutter:
permission_handler: ^11.4.0
geocoding: ^3.0.0
image_picker: ^1.1.2
firebase_storage: ^13.0.4
flutter_tts: ^4.2.3
speech_to_text: ^7.0.0
gap: ^3.0.1
intl: ^0.20.2
webview_flutter: ^4.13.0
image: ^4.5.4
url_launcher: ^6.3.1
video_player: any
chewie: ^1.12.1
audioplayers: ^6.5.0
internet_connection_checker: ^3.0.1
fluttertoast: ^8.2.12
connectivity_plus: ^6.1.4
isar: ^3.1.0+1
isar_flutter_libs: any
path_provider: ^2.1.5
razorpay_flutter: ^1.4.0
country_picker: ^2.0.27
firebase_crashlytics: ^5.0.4
firebase_app_check: ^0.4.1+2

dev_dependencies:
flutter_test:
sdk: flutter

flutter_lints: ^5.0.0
build_runner: ^2.4.11
isar_generator: ^3.1.0+1
analyzer: ^5.13.0

For information on the generic Dart part of this file, see the

following page: https://dart.dev/tools/pub/pubspec

The following section is specific to Flutter packages.

flutter:

The following line ensures that the Material Icons font is

included with your application, so that you can use the icons in

the material Icons class.

uses-material-design: true

To add assets to your application, add an assets section, like this:

assets:
- assets/icons/
- assets/images/

- images/a_dot_ham.jpeg

An image asset can refer to one or more resolution-specific "variants", see

https://flutter.dev/to/resolution-aware-images

For details regarding adding assets from package dependencies, see

https://flutter.dev/to/asset-from-package

To add custom fonts to your application, add a fonts section here,

in this "flutter" section. Each entry in this list should have a

"family" key with the font family name, and a "fonts" key with a

list giving the asset and other descriptors for the font. For

example:

fonts:
- family: Poppins
fonts:
- asset: assets/fonts/Poppins/Poppins-Thin.ttf
weight: 100

    - asset: assets/fonts/Poppins/Poppins-ExtraLight.ttf
      weight: 200

    - asset: assets/fonts/Poppins/Poppins-Light.ttf
      weight: 300

    - asset: assets/fonts/Poppins/Poppins-Regular.ttf
      weight: 400

    - asset: assets/fonts/Poppins/Poppins-Medium.ttf
      weight: 500

    - asset: assets/fonts/Poppins/Poppins-SemiBold.ttf
      weight: 600

    - asset: assets/fonts/Poppins/Poppins-Bold.ttf
      weight: 700

    - asset: assets/fonts/Poppins/Poppins-ExtraBold.ttf
      weight: 800

    - asset: assets/fonts/Poppins/Poppins-Black.ttf
      weight: 900

- family: Trajan Pro

fonts:

- asset: fonts/TrajanPro.ttf

- asset: fonts/TrajanPro_Bold.ttf

weight: 700

For details regarding fonts from package dependencies,

see https://flutter.dev/to/font-from-package

Additional context and comments

What’s Already Checked

✅ All SHA-1 and SHA-256 keys (debug, release, and Play Store) added to Firebase Console
✅ Works fine in debug/release builds locally
✅ Tested on multiple devices

Metadata

Metadata

Assignees

No one assigned

    Labels

    StaleIssue with no recent activityblocked: customer-responseWaiting for customer response, e.g. more information was requested.platform: androidIssues / PRs which are specifically for Android.plugin: authtype: bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions