8

Everything was working fine before but now firebase can't seem to create a new token. I'm trying to call await FirebaseMessaging.instance.getToken(); but getting this error


FLTFirebaseMessaging: An error occurred while calling method Messaging#getToken, errorOrNil => {
    NSLocalizedFailureReason = "Too many server requests.";
}
[VERBOSE-2:ui_dart_state.cc(199)] Unhandled Exception: [firebase_messaging/unknown] An unknown error has occurred.
#0      MethodChannelFirebaseMessaging.getToken (package:firebase_messaging_platform_interface/src/method_channel/method_channel_messaging.dart:226:7)
<asynchronous suspension>
#1      _SignUpState._sendVerificationCode (package:shuri_parent/src/pages/sign_up.dart:343:25)
<asynchronous suspension>
#2      _SignUpState.build.<anonymous closure> (package:shuri_parent/src/pages/sign_up.dart:252:43)
<asynchronous suspension>

I'm using firebase_messaging: : ^10.0.9

My application is broken in production, I really need your help guys.

This is my flutter doctor

Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel master, 2.3.0-17.0.pre.121, on Mac OS X 10.15.7 19H1419
    darwin-x64, locale en-RW)
[✓] Android toolchain - develop for Android devices (Android SDK version 30.0.3)
[✓] Xcode - develop for iOS and macOS
[✓] Chrome - develop for the web
[✓] Android Studio (version 4.2)
[✓] VS Code (version 1.61.0)
[✓] Connected device (2 available)

• No issues found!

Also my app is just recently deployed and doesn't have more than 10 users, other can't seem to use the app due to this blocker. Your help will be much appreciated.

McWally
  • 217
  • 2
  • 5

7 Answers7

5

Oh! my bad, I found the issue. My issue was a wrong api key of firebase in the GoogleServices-info.plist file

Thanks for all the support you gave me.

McWally
  • 217
  • 2
  • 5
3

in my case I have different bundle identifier on Xcode and in Firebase Console.

I have this issue after implementing Flavor on Flutter app. the Bundle Identifier is created dynamically based on the scheme on my Xcode

Alexa289
  • 8,089
  • 10
  • 74
  • 178
3

I resolved this issue by redownloading the GoogleService-Info.plist from the firebase & replace the current file.

Jithin U. Ahmed
  • 1,495
  • 1
  • 19
  • 29
1

This issue is caused by limited permission to your api key from Google cloud console, here are steps that fixed my issue,

  1. Login to Google cloud console and select your current project

  2. Select **API Credentials - APIs & Services ** or IAM Permissions on left sidebar.

  3. Select iOS key(auto created by firebase)'s menu on right if you have selected **API Credentials - APIs & Services **

  4. Select Edit API key

  5. Under Selected APIs: dropdown menu select these options, Firebase Installation API Firebase Cloud Messaging API FCM Registration API

enter image description here

0

Make sure that your Flutter app targets iOS 8 or later. Please check this link below

https://firebase.google.com/docs/flutter/setup?platform=ios

in some android and ios devices not receiving firbase base responce because of its versions and api level

Hamed Rajabi Varamini
  • 3,439
  • 3
  • 24
  • 38
Jinto Joseph
  • 947
  • 6
  • 23
  • 1
    Yes it has target IOS 10.0, Befor It was working fine in production until it started showing that error only on `getToken()` on users mobile phones. – McWally Oct 27 '21 at 13:07
0

make sure you add push notification config in xcodeenter image description here

-1

Turn out the error throw because I'm using a vpn app. Try to change your network to a different network then try again

Kyo Huu
  • 520
  • 7
  • 13